mirror of
https://github.com/wahyd4/you-music.git
synced 2026-08-08 20:59:47 +10:00
59 lines
2.1 KiB
Python
59 lines
2.1 KiB
Python
"""Initial migration
|
|
|
|
Revision ID: 01209c730b33
|
|
Revises:
|
|
Create Date: 2025-10-30 21:11:30.801811
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '01209c730b33'
|
|
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('app_settings',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('key', sa.String(), nullable=True),
|
|
sa.Column('value', sa.Text(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
with op.batch_alter_table('app_settings', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_app_settings_id'), ['id'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_app_settings_key'), ['key'], unique=True)
|
|
|
|
with op.batch_alter_table('music', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('file_format', sa.String(), nullable=True))
|
|
batch_op.add_column(sa.Column('file_location', sa.String(), nullable=True))
|
|
batch_op.add_column(sa.Column('file_exists', sa.Boolean(), nullable=True))
|
|
batch_op.add_column(sa.Column('last_scanned_at', sa.DateTime(), nullable=True))
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('music', schema=None) as batch_op:
|
|
batch_op.drop_column('last_scanned_at')
|
|
batch_op.drop_column('file_exists')
|
|
batch_op.drop_column('file_location')
|
|
batch_op.drop_column('file_format')
|
|
|
|
with op.batch_alter_table('app_settings', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_app_settings_key'))
|
|
batch_op.drop_index(batch_op.f('ix_app_settings_id'))
|
|
|
|
op.drop_table('app_settings')
|
|
# ### end Alembic commands ###
|