1 """Remove name column for notification policies
2
3 Revision ID: 42762c37b7bc
4 Revises: dff8da7a6c2c
5 Create Date: 2022-06-29 15:18:32.845646
6
7 """
8
9 import sqlalchemy as sa 1 ctx 1a
10 from alembic import op 1 ctx 1a
11
12 # revision identifiers, used by Alembic.
13 revision = "42762c37b7bc" 1 ctx 1a
14 down_revision = "dff8da7a6c2c" 1 ctx 1a
15 branch_labels = None 1 ctx 1a
16 depends_on = None 1 ctx 1a
17
18
19 def upgrade ( ) : 1 ctx 1a
20 with op . batch_alter_table ( "flow_run_notification_policy" , schema = None ) as batch_op : 1 ctx 1a
21 batch_op . drop_index ( "ix_flow_run_notification_policy__name" ) 1 ctx 1a
22 batch_op . drop_column ( "name" ) 1 ctx 1a
23
24 # ### end Alembic commands ###
25
26
27 def downgrade ( ) : 1 ctx 1a
28 # ### commands auto generated by Alembic - please adjust! ###
29 with op . batch_alter_table ( "flow_run_notification_policy" , schema = None ) as batch_op :
30 # note we add a NULLABLE column even though the original wasn't to avoid locking the database
31 # if there's a lot of data (the original column was not nullable)
32 batch_op . add_column ( sa . Column ( "name" , sa . VARCHAR ( ) , nullable = True ) )
33 batch_op . create_index (
34 "ix_flow_run_notification_policy__name" , [ "name" ] , unique = False
35 )
36
37 # ### end Alembic commands ###