Coverage for /usr/local/lib/python3.12/site-packages/prefect/server/database/_migrations/versions/sqlite/2023_04_04_115150_553920ec20e9_add_index_on_log.py: 73%

15 statements  

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

1"""add_index_on_log 

2 

3Revision ID: 553920ec20e9 

4Revises: 422f8ba9541d 

5Create Date: 2023-04-04 11:51:50.514999 

6 

7""" 

8 

9from alembic import op 1a

10 

11# revision identifiers, used by Alembic. 

12revision = "553920ec20e9" 1a

13down_revision = "422f8ba9541d" 1a

14branch_labels = None 1a

15depends_on = None 1a

16 

17 

18def upgrade(): 1a

19 op.execute("PRAGMA foreign_keys=OFF") 1a

20 

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

22 batch_op.create_index( 1a

23 "ix_log__flow_run_id_timestamp", ["flow_run_id", "timestamp"], unique=False 

24 ) 

25 

26 op.execute("PRAGMA foreign_keys=ON") 1a

27 

28 

29def downgrade(): 1a

30 op.execute("PRAGMA foreign_keys=OFF") 

31 

32 with op.batch_alter_table("log", schema=None) as batch_op: 

33 batch_op.drop_index("ix_log__flow_run_id_timestamp") 

34 

35 op.execute("PRAGMA foreign_keys=ON")