Files
digiserver/migrations/versions/54d8ece92767_add_position_field_to_content_model.py

47 lines
1.4 KiB
Python

"""Add position field to Content model
Revision ID: 54d8ece92767
Revises:
Create Date: 2025-06-29 15:32:30.794390
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '54d8ece92767'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('content', schema=None) as batch_op:
batch_op.add_column(sa.Column('position', sa.Integer(), nullable=True))
batch_op.alter_column('file_name',
existing_type=sa.VARCHAR(length=120),
type_=sa.String(length=255),
existing_nullable=False)
batch_op.alter_column('player_id',
existing_type=sa.INTEGER(),
nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('content', schema=None) as batch_op:
batch_op.alter_column('player_id',
existing_type=sa.INTEGER(),
nullable=True)
batch_op.alter_column('file_name',
existing_type=sa.String(length=255),
type_=sa.VARCHAR(length=120),
existing_nullable=False)
batch_op.drop_column('position')
# ### end Alembic commands ###