def upgrade():
# batch_alter_table() is necessary here because SQLite does not support
# the SQL ALTER statement which would normally be emitted here.
# What this function does is basically cause all the data in the old
# version of the table to be copied into a new table, then delete the old
# table at the end if everything works as planned.
with op.batch_alter_table('menu_entries') as batch_op:
batch_op.create_unique_constraint(
constraint_name="unique_menu_entry_date_mensa_category_description",
columns=['date_valid', 'mensa', 'category', 'description'])
评论列表
文章目录