82 lines
3.3 KiB
Python
82 lines
3.3 KiB
Python
"""Initial migration
|
|
|
|
Revision ID: 8c205bad71fb
|
|
Revises:
|
|
Create Date: 2026-01-27 13:23:40.208303
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '8c205bad71fb'
|
|
down_revision: Union[str, Sequence[str], None] = None
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('projects',
|
|
sa.Column('id', sa.UUID(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.Column('resolution', sa.String(), nullable=True),
|
|
sa.Column('aspect_ratio', sa.String(), nullable=True),
|
|
sa.Column('veo_version', sa.String(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('ingredients',
|
|
sa.Column('id', sa.UUID(), nullable=False),
|
|
sa.Column('project_id', sa.UUID(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.Column('type', sa.Enum('Character', 'Location', 'Object', 'Style', name='asset_type'), nullable=False),
|
|
sa.Column('s3_key', sa.String(), nullable=False),
|
|
sa.Column('s3_bucket', sa.String(), nullable=True),
|
|
sa.Column('thumbnail_key', sa.String(), nullable=True),
|
|
sa.Column('metadata', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='CASCADE'),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('scenes',
|
|
sa.Column('id', sa.UUID(), nullable=False),
|
|
sa.Column('project_id', sa.UUID(), nullable=False),
|
|
sa.Column('slugline', sa.String(), nullable=False),
|
|
sa.Column('raw_content', sa.Text(), nullable=True),
|
|
sa.Column('sequence_number', sa.Integer(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='CASCADE'),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('shots',
|
|
sa.Column('id', sa.UUID(), nullable=False),
|
|
sa.Column('scene_id', sa.UUID(), nullable=False),
|
|
sa.Column('description', sa.Text(), nullable=False),
|
|
sa.Column('duration', sa.Float(), nullable=True),
|
|
sa.Column('sequence_number', sa.Integer(), nullable=True),
|
|
sa.Column('assigned_ingredients', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
|
sa.Column('llm_context_cache', sa.Text(), nullable=True),
|
|
sa.Column('veo_json_payload', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
|
sa.Column('status', sa.String(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['scene_id'], ['scenes.id'], ondelete='CASCADE'),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('shots')
|
|
op.drop_table('scenes')
|
|
op.drop_table('ingredients')
|
|
op.drop_table('projects')
|
|
# ### end Alembic commands ###
|