PaperParser/migrations/versions/d573f6529ad5_added_name_fie...

35 lines
921 B
Python
Raw Permalink Normal View History

2024-03-07 02:22:24 +10:00
"""Added name field to collections
Revision ID: d573f6529ad5
Revises: 21750f5bbab1
Create Date: 2024-03-06 01:45:54.772732
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd573f6529ad5'
down_revision = '21750f5bbab1'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('collection', schema=None) as batch_op:
batch_op.add_column(sa.Column('name', sa.String(), nullable=False))
batch_op.create_unique_constraint(None, ['name'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('collection', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='unique')
batch_op.drop_column('name')
# ### end Alembic commands ###