videogen/migrations/versions/20260930_1000_f3b5d7e9a1c2_character_hub.py
caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

79 lines
3.6 KiB
Python

"""My characters and brands: ``character_hub_profiles``, ``character_identity_scores`` (Wave P PM1.4, MH4)
A profile row records what kind of character it is (an original narrator or
your own face) and, for a real face, the consent phrase result and the
Identity Lock passport. A score row records one render's appearance
similarity to the character's reference. Purely additive and idempotent.
Revision ID: f3b5d7e9a1c2
Revises: e2a4c6d8f0b1
Create Date: 2026-09-30 10:00:00.000000+00:00
"""
from __future__ import annotations
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = 'f3b5d7e9a1c2'
down_revision: Union[str, None] = 'e2a4c6d8f0b1'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def _tables() -> set[str]:
return set(sa.inspect(op.get_bind()).get_table_names())
def _indexes(table: str) -> set[str]:
return {i["name"] for i in sa.inspect(op.get_bind()).get_indexes(table)}
def upgrade() -> None:
tables = _tables()
if "character_hub_profiles" not in tables:
op.create_table(
"character_hub_profiles",
sa.Column("character_id", sa.String(length=32), nullable=False),
sa.Column("user_id", sa.String(length=32), nullable=False),
sa.Column("kind", sa.String(length=20), nullable=False),
sa.Column("narrator_id", sa.String(length=40), nullable=False, server_default=""),
sa.Column("consent_verified_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("consent_words_heard", sa.Integer(), nullable=False, server_default="0"),
sa.Column("consent_words_total", sa.Integer(), nullable=False, server_default="0"),
sa.Column("passport_id", sa.String(length=80), nullable=False, server_default=""),
sa.Column("passport_version", sa.Integer(), nullable=False, server_default="0"),
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=True),
sa.PrimaryKeyConstraint("character_id"),
)
if "ix_character_hub_profiles_user_id" not in _indexes("character_hub_profiles"):
op.create_index("ix_character_hub_profiles_user_id", "character_hub_profiles", ["user_id"])
if "character_identity_scores" not in tables:
op.create_table(
"character_identity_scores",
sa.Column("id", sa.String(length=32), nullable=False),
sa.Column("character_id", sa.String(length=32), nullable=False),
sa.Column("user_id", sa.String(length=32), nullable=False),
sa.Column("job_id", sa.String(length=32), nullable=False),
sa.Column("preset_id", sa.String(length=80), nullable=False, server_default=""),
sa.Column("model", sa.String(length=80), nullable=False, server_default=""),
sa.Column("score", sa.Float(), nullable=False),
sa.Column("method", sa.String(length=40), nullable=False, server_default="appearance-v1"),
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
if "ix_character_identity_scores_character_id" not in _indexes("character_identity_scores"):
op.create_index("ix_character_identity_scores_character_id", "character_identity_scores", ["character_id"])
def downgrade() -> None:
tables = _tables()
if "character_identity_scores" in tables:
op.drop_table("character_identity_scores")
if "character_hub_profiles" in tables:
op.drop_table("character_hub_profiles")