From bf496cb8068f00aed3ac29bc36addfcc9923f349 Mon Sep 17 00:00:00 2001 From: semen603089 Date: Sun, 7 Apr 2024 02:08:43 +0300 Subject: [PATCH] migration --- .../versions/1bb798899506_button_scopes.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 migrations/versions/1bb798899506_button_scopes.py diff --git a/migrations/versions/1bb798899506_button_scopes.py b/migrations/versions/1bb798899506_button_scopes.py new file mode 100644 index 0000000..713b773 --- /dev/null +++ b/migrations/versions/1bb798899506_button_scopes.py @@ -0,0 +1,34 @@ +"""button_scopes + +Revision ID: 1bb798899506 +Revises: d6b21dcb2c75 +Create Date: 2024-04-06 20:47:43.848321 + +""" +import sqlalchemy as sa +from alembic import op + + +# revision identifiers, used by Alembic. +revision = '1bb798899506' +down_revision = 'd6b21dcb2c75' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('scope', sa.Column('button_id', sa.Integer(), nullable=True)) + op.add_column('scope', sa.Column('is_required', sa.Boolean(), nullable=True)) + op.alter_column('scope', 'category_id', existing_type=sa.INTEGER(), nullable=True) + op.create_foreign_key(None, 'scope', 'button', ['button_id'], ['id']) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_constraint(None, 'scope', type_='foreignkey') + op.alter_column('scope', 'category_id', existing_type=sa.INTEGER(), nullable=False) + op.drop_column('scope', 'is_required') + op.drop_column('scope', 'button_id') + # ### end Alembic commands ###