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

13 statements  

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

1"""Add block schema indexes 

2 

3Revision ID: 9e2a1c08c6f1 

4Revises: 2d900af9cd07 

5Create Date: 2022-06-17 20:45:30.744575 

6 

7""" 

8 

9from alembic import op 1a

10 

11# revision identifiers, used by Alembic. 

12revision = "9e2a1c08c6f1" 1a

13down_revision = "2d900af9cd07" 1a

14branch_labels = None 1a

15depends_on = None 1a

16 

17 

18def upgrade(): 1a

19 # ### commands auto generated by Alembic - please adjust! ### 

20 op.create_index( 1a

21 op.f("ix_block_schema__block_type_id"), 

22 "block_schema", 

23 ["block_type_id"], 

24 unique=False, 

25 ) 

26 op.create_index( 1a

27 op.f("ix_block_schema__created"), "block_schema", ["created"], unique=False 

28 ) 

29 

30 # there is already a unique index on this column, so this btree index is redundant 

31 op.drop_index(op.f("ix_block_schema__checksum"), table_name="block_schema") 1a

32 

33 # ### end Alembic commands ### 

34 

35 

36def downgrade(): 1a

37 # ### commands auto generated by Alembic - please adjust! ### 

38 op.drop_index(op.f("ix_block_schema__created"), table_name="block_schema") 

39 op.drop_index(op.f("ix_block_schema__block_type_id"), table_name="block_schema") 

40 op.create_index( 

41 op.f("ix_block_schema__checksum"), "block_schema", ["checksum"], unique=False 

42 ) 

43 # ### end Alembic commands ###