From 453cacebd959a26a4af2da4fcf470c53bbc9a8cd Mon Sep 17 00:00:00 2001 From: Midgard Date: Fri, 20 May 2022 20:01:34 +0200 Subject: [PATCH] Add migration to add slug DB field to order --- .../versions/29ccbe077c57_add_slug.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/migrations/versions/29ccbe077c57_add_slug.py diff --git a/app/migrations/versions/29ccbe077c57_add_slug.py b/app/migrations/versions/29ccbe077c57_add_slug.py new file mode 100644 index 0000000..6e527e9 --- /dev/null +++ b/app/migrations/versions/29ccbe077c57_add_slug.py @@ -0,0 +1,23 @@ +"""add slug + +Revision ID: 29ccbe077c57 +Revises: 55013fe95bea +Create Date: 2022-05-20 19:46:11.924218 + +""" + +# revision identifiers, used by Alembic. +revision = '29ccbe077c57' +down_revision = '55013fe95bea' + +from alembic import op +import sqlalchemy as sa + +def upgrade(): + op.add_column('order', sa.Column('slug', sa.String(length=7), nullable=True)) + op.create_unique_constraint(None, 'order', ['slug']) + + +def downgrade(): + op.drop_constraint(None, 'order', type_='unique') + op.drop_column('order', 'slug')