Coverage for /usr/local/lib/python3.12/site-packages/prefect/server/database/_migrations/versions/postgresql/2022_07_21_133134_e085c9cbf8ce_remove_flow_runners.py: 70%

23 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 02:04 +0000

1"""Remove flow runners 

2 

3Revision ID: e085c9cbf8ce 

4Revises: bb4dc90d3e29 

5Create Date: 2022-07-21 13:31:34.045385 

6 

7""" 

8 

9import sqlalchemy as sa 

10from alembic import op 

11from sqlalchemy.dialects import postgresql 

12 

13# revision identifiers, used by Alembic. 

14revision = "e085c9cbf8ce" 

15down_revision = "0cf7311d6ea6" 

16branch_labels = None 

17depends_on = None 

18 

19 

20def upgrade(): 

21 op.drop_column("deployment", "flow_runner_type") 

22 op.drop_column("deployment", "flow_runner_config") 

23 op.drop_column("deployment", "description") 

24 op.drop_index(op.f("ix_flow_run__flow_runner_type"), table_name="flow_run") 

25 op.drop_column("flow_run", "flow_runner_type") 

26 op.drop_column("flow_run", "flow_runner_config") 

27 op.drop_column("flow_run", "empirical_config") 

28 

29 

30def downgrade(): 

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

32 op.add_column( 

33 "flow_run", 

34 sa.Column( 

35 "empirical_config", 

36 postgresql.JSONB(astext_type=sa.Text()), 

37 server_default=sa.text("'{}'::jsonb"), 

38 autoincrement=False, 

39 nullable=False, 

40 ), 

41 ) 

42 op.add_column( 

43 "flow_run", 

44 sa.Column( 

45 "flow_runner_config", 

46 postgresql.JSONB(astext_type=sa.Text()), 

47 autoincrement=False, 

48 nullable=True, 

49 ), 

50 ) 

51 op.add_column( 

52 "flow_run", 

53 sa.Column("flow_runner_type", sa.VARCHAR(), autoincrement=False, nullable=True), 

54 ) 

55 

56 op.create_index( 

57 op.f("ix_flow_run__flow_runner_type"), 

58 "flow_run", 

59 ["flow_runner_type"], 

60 unique=False, 

61 ) 

62 

63 op.add_column( 

64 "deployment", 

65 sa.Column("description", sa.TEXT(), autoincrement=False, nullable=True), 

66 ) 

67 op.add_column( 

68 "deployment", 

69 sa.Column( 

70 "flow_runner_config", 

71 postgresql.JSONB(astext_type=sa.Text()), 

72 autoincrement=False, 

73 nullable=True, 

74 ), 

75 ) 

76 op.add_column( 

77 "deployment", 

78 sa.Column("flow_runner_type", sa.VARCHAR(), autoincrement=False, nullable=True), 

79 )