diff --git a/_database/sql/migrations/2026-04-02-083548-0000_characters/up.sql b/_database/sql/migrations/2026-04-02-083548-0000_characters/up.sql index 1332baa275..cece8e53f7 100644 --- a/_database/sql/migrations/2026-04-02-083548-0000_characters/up.sql +++ b/_database/sql/migrations/2026-04-02-083548-0000_characters/up.sql @@ -2,6 +2,9 @@ -- noinspection SqlNoDataSourceInspectionForFile -- noinspection SqlResolveForFile +-- Characters are reusable entities that can be referenced in video/image generations. +-- A character is created from one or more reference images and registered with third-party +-- systems (e.g. Kinovi/Seedance) that support character-based generation. CREATE TABLE characters ( -- Not used for anything except replication (private, not even used in queries) id BIGINT(20) NOT NULL AUTO_INCREMENT, @@ -9,6 +12,9 @@ CREATE TABLE characters ( -- Public-facing "primary key" (PUBLIC) token VARCHAR(32) NOT NULL, + -- The type or "features" of the character. + character_type VARCHAR(32) DEFAULT NULL, + -- Whether the character has been fully created and is available for use. -- A character may exist in the database before its creation job completes. is_active BOOLEAN NOT NULL DEFAULT false, @@ -83,6 +89,7 @@ CREATE TABLE characters ( PRIMARY KEY (id), UNIQUE KEY (token), + KEY index_character_type (character_type), KEY index_maybe_creator_user_token (maybe_creator_user_token), KEY index_is_active (is_active), KEY index_kinovi_character_id (kinovi_character_id), diff --git a/_database/sql/migrations_squashed/characters/characters.sql b/_database/sql/migrations_squashed/characters/characters.sql index b78132d2fc..4e2dea9c47 100644 --- a/_database/sql/migrations_squashed/characters/characters.sql +++ b/_database/sql/migrations_squashed/characters/characters.sql @@ -15,6 +15,9 @@ CREATE TABLE characters ( -- Effective "primary key" (PUBLIC) token VARCHAR(32) NOT NULL, + -- The type or "features" of the character. + character_type VARCHAR(32) DEFAULT NULL, + -- Whether the character has been fully created and is available for use. -- A character may exist in the database before its creation job completes. is_active BOOLEAN NOT NULL DEFAULT false, @@ -35,6 +38,11 @@ CREATE TABLE characters ( -- Full-size reference image. maybe_full_image_media_token VARCHAR(32) DEFAULT NULL, + -- TEMPORARY FOR GOING FAST : + -- WE'LL NEED TO BREAK THIS INTO ANOTHER TABLE IF WE WANT TO SUPPORT MULTIPLE IMAGES. + -- Image the character was originally created with. + maybe_original_upload_media_token VARCHAR(32) DEFAULT NULL, + -- ========== CREATOR ========== -- The user who created this character. @@ -43,6 +51,37 @@ CREATE TABLE characters ( -- For abuse tracking. creator_ip_address VARCHAR(40) NOT NULL, + -- ========== KINOVI (TEMPORARY) ========== + + -- TEMPORARY FOR GOING FAST : + -- IDEALLY WE MOVE THIS TO A SEPARATE TABLE. + -- The identifier in the third-party system. + -- e.g. Kinovi's "char_1774752056469_2wlxoq" + kinovi_character_id VARCHAR(64) DEFAULT NULL, + + -- TEMPORARY FOR GOING FAST : + -- IDEALLY WE MOVE THIS TO A SEPARATE TABLE. + -- The name used by the third party. + -- Important for Kinovi since characters are referenced by name in prompts. + kinovi_name VARCHAR(255) DEFAULT NULL, + + -- TEMPORARY FOR GOING FAST : + -- IDEALLY WE MOVE THIS TO A SEPARATE TABLE. + -- This might be the upstream third party of kinovi. + -- e.g. Kinovi's assetId "asset-20260329104101-kk5kl" + maybe_kinovi_asset_id VARCHAR(64) DEFAULT NULL, + + -- TEMPORARY FOR GOING FAST : + -- IDEALLY WE MOVE THIS TO A SEPARATE TABLE. + -- Our job system token (if the character was created via a job). + maybe_generic_inference_job_token VARCHAR(32) DEFAULT NULL, + + -- Maybe this doesn't exist + -- -- TEMPORARY FOR GOING FAST : + -- -- IDEALLY WE MOVE THIS TO A SEPARATE TABLE. + -- -- Third party's job system token (if any). + -- maybe_kinovi_job_id VARCHAR(64) DEFAULT NULL, + -- ========== TIMESTAMPS ========== created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -53,8 +92,13 @@ CREATE TABLE characters ( PRIMARY KEY (id), UNIQUE KEY (token), + KEY index_character_type (character_type), KEY index_maybe_creator_user_token (maybe_creator_user_token), KEY index_is_active (is_active), - KEY index_created_at (created_at) + KEY index_kinovi_character_id (kinovi_character_id), + KEY index_maybe_generic_inference_job_token (maybe_generic_inference_job_token), + KEY index_maybe_kinovi_job_id (maybe_kinovi_job_id), + KEY index_created_at (created_at), + KEY index_deleted_at (deleted_at) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;