"""add_video_tables Revision ID: 0b6d33dcfe94 Revises: ad5a56553d20 Create Date: 2025-12-30 19:23:49.165420 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision: str = '0b6d33dcfe94' down_revision: Union[str, Sequence[str], None] = 'ad5a56553d20' 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('video', sa.Column('id', sa.Integer(), nullable=False), sa.Column('url', sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column('title', sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column('description', sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column('platform', sa.Enum('YOUTUBE', 'VIMEO', 'NUGS', 'BANDCAMP', 'ARCHIVE', 'OTHER', name='videoplatform'), nullable=False), sa.Column('video_type', sa.Enum('FULL_SHOW', 'SINGLE_SONG', 'SEQUENCE', 'INTERVIEW', 'DOCUMENTARY', 'LIVE_STREAM', 'OTHER', name='videotype'), nullable=False), sa.Column('duration_seconds', sa.Integer(), nullable=True), sa.Column('thumbnail_url', sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column('external_id', sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column('recorded_date', sa.DateTime(), nullable=True), sa.Column('published_date', sa.DateTime(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('vertical_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['vertical_id'], ['vertical.id'], ), sa.PrimaryKeyConstraint('id') ) with op.batch_alter_table('video', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_video_url'), ['url'], unique=False) batch_op.create_index(batch_op.f('ix_video_vertical_id'), ['vertical_id'], unique=False) op.create_table('videomusician', sa.Column('id', sa.Integer(), nullable=False), sa.Column('video_id', sa.Integer(), nullable=False), sa.Column('musician_id', sa.Integer(), nullable=False), sa.Column('role', sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column('notes', sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.ForeignKeyConstraint(['musician_id'], ['musician.id'], ), sa.ForeignKeyConstraint(['video_id'], ['video.id'], ), sa.PrimaryKeyConstraint('id') ) with op.batch_alter_table('videomusician', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_videomusician_musician_id'), ['musician_id'], unique=False) batch_op.create_index(batch_op.f('ix_videomusician_video_id'), ['video_id'], unique=False) op.create_table('videoshow', sa.Column('id', sa.Integer(), nullable=False), sa.Column('video_id', sa.Integer(), nullable=False), sa.Column('show_id', sa.Integer(), nullable=False), sa.Column('notes', sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.ForeignKeyConstraint(['show_id'], ['show.id'], ), sa.ForeignKeyConstraint(['video_id'], ['video.id'], ), sa.PrimaryKeyConstraint('id') ) with op.batch_alter_table('videoshow', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_videoshow_show_id'), ['show_id'], unique=False) batch_op.create_index(batch_op.f('ix_videoshow_video_id'), ['video_id'], unique=False) op.create_table('videosong', sa.Column('id', sa.Integer(), nullable=False), sa.Column('video_id', sa.Integer(), nullable=False), sa.Column('song_id', sa.Integer(), nullable=False), sa.Column('notes', sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.ForeignKeyConstraint(['song_id'], ['song.id'], ), sa.ForeignKeyConstraint(['video_id'], ['video.id'], ), sa.PrimaryKeyConstraint('id') ) with op.batch_alter_table('videosong', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_videosong_song_id'), ['song_id'], unique=False) batch_op.create_index(batch_op.f('ix_videosong_video_id'), ['video_id'], unique=False) op.create_table('videoperformance', sa.Column('id', sa.Integer(), nullable=False), sa.Column('video_id', sa.Integer(), nullable=False), sa.Column('performance_id', sa.Integer(), nullable=False), sa.Column('timestamp_start', sa.Integer(), nullable=True), sa.Column('timestamp_end', sa.Integer(), nullable=True), sa.Column('notes', sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.ForeignKeyConstraint(['performance_id'], ['performance.id'], ), sa.ForeignKeyConstraint(['video_id'], ['video.id'], ), sa.PrimaryKeyConstraint('id') ) with op.batch_alter_table('videoperformance', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_videoperformance_performance_id'), ['performance_id'], unique=False) batch_op.create_index(batch_op.f('ix_videoperformance_video_id'), ['video_id'], unique=False) # ### end Alembic commands ### def downgrade() -> None: """Downgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('videoperformance', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_videoperformance_video_id')) batch_op.drop_index(batch_op.f('ix_videoperformance_performance_id')) op.drop_table('videoperformance') with op.batch_alter_table('videosong', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_videosong_video_id')) batch_op.drop_index(batch_op.f('ix_videosong_song_id')) op.drop_table('videosong') with op.batch_alter_table('videoshow', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_videoshow_video_id')) batch_op.drop_index(batch_op.f('ix_videoshow_show_id')) op.drop_table('videoshow') with op.batch_alter_table('videomusician', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_videomusician_video_id')) batch_op.drop_index(batch_op.f('ix_videomusician_musician_id')) op.drop_table('videomusician') with op.batch_alter_table('video', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_video_vertical_id')) batch_op.drop_index(batch_op.f('ix_video_url')) op.drop_table('video') # ### end Alembic commands ###