33 lines
865 B
Plaintext
33 lines
865 B
Plaintext
"""Example migration - add rating column to metadata
|
|
|
|
This is an example of how to create a migration.
|
|
To use this:
|
|
1. Remove the .example extension
|
|
2. Update the revision ID and down_revision
|
|
3. Run: migrate upgrade
|
|
|
|
Revision ID: 002
|
|
Revises: 001
|
|
Create Date: 2024-01-01 11:00:00.000000
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '002'
|
|
down_revision = '001'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Add a rating column to the metadata table
|
|
with op.batch_alter_table('metadata', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('rating', sa.Float(), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
# Remove the rating column from the metadata table
|
|
with op.batch_alter_table('metadata', schema=None) as batch_op:
|
|
batch_op.drop_column('rating') |