-- M19 角色多状态/造型变体

CREATE TABLE character_states (
    id                    BIGINT          NOT NULL PRIMARY KEY,
    project_id            BIGINT          NOT NULL,
    tenant_id             BIGINT          NOT NULL,
    character_id          BIGINT          NOT NULL,
    name                  VARCHAR(128)    NOT NULL,
    state_type            VARCHAR(32)     DEFAULT 'costume',
    description           TEXT,
    prompt                TEXT,
    reference_image_key   VARCHAR(512),
    image_url             VARCHAR(1024),
    image_tos_key         VARCHAR(512),
    status                VARCHAR(32)     NOT NULL DEFAULT 'draft',
    created_at            DATETIME(3)     NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    updated_at            DATETIME(3)     NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
    INDEX idx_project (project_id),
    INDEX idx_character (character_id),
    INDEX idx_tenant (tenant_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
