Coverage for /usr/local/lib/python3.12/site-packages/prefect/server/database/_migrations/versions/sqlite/2022_06_29_151832_42762c37b7bc_remove_name_column_for_notification_.py: 79%

14 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 10:48 +0000

1"""Remove name column for notification policies 

2 

3Revision ID: 42762c37b7bc 

4Revises: dff8da7a6c2c 

5Create Date: 2022-06-29 15:18:32.845646 

6 

7""" 

8 

9import sqlalchemy as sa 1a

10from alembic import op 1a

11 

12# revision identifiers, used by Alembic. 

13revision = "42762c37b7bc" 1a

14down_revision = "dff8da7a6c2c" 1a

15branch_labels = None 1a

16depends_on = None 1a

17 

18 

19def upgrade(): 1a

20 with op.batch_alter_table("flow_run_notification_policy", schema=None) as batch_op: 1a

21 batch_op.drop_index("ix_flow_run_notification_policy__name") 1a

22 batch_op.drop_column("name") 1a

23 

24 # ### end Alembic commands ### 

25 

26 

27def downgrade(): 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 ###