Files
you-music/backend/alembic/versions/dcb7e2f03d2b_add_thumbnail_to_download_jobs.py
T
2025-11-07 20:42:44 +11:00

51 lines
1.7 KiB
Python

"""Add thumbnail to download_jobs
Revision ID: dcb7e2f03d2b
Revises: 86ec19b8f5ce
Create Date: 2025-11-07 20:26:29.893708
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'dcb7e2f03d2b'
down_revision: Union[str, Sequence[str], None] = '86ec19b8f5ce'
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! ###
with op.batch_alter_table('download_jobs', schema=None) as batch_op:
batch_op.add_column(sa.Column('thumbnail', sa.String(), nullable=True))
with op.batch_alter_table('music', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_music_created_at'))
batch_op.drop_index(batch_op.f('ix_music_updated_at'))
with op.batch_alter_table('playlists', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_playlists_created_at'))
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('playlists', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_playlists_created_at'), ['created_at'], unique=False)
with op.batch_alter_table('music', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_music_updated_at'), ['updated_at'], unique=False)
batch_op.create_index(batch_op.f('ix_music_created_at'), ['created_at'], unique=False)
with op.batch_alter_table('download_jobs', schema=None) as batch_op:
batch_op.drop_column('thumbnail')
# ### end Alembic commands ###