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

19 statements  

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

1"""add_created_by 

2 

3Revision ID: fa319f214160 

4Revises: ad4b1b4d1e9d 

5Create Date: 2022-10-19 09:35:42.371899 

6 

7""" 

8 

9import sqlalchemy as sa 1a

10from alembic import op 1a

11 

12import prefect 1a

13 

14# revision identifiers, used by Alembic. 

15revision = "fa319f214160" 1a

16down_revision = "ad4b1b4d1e9d" 1a

17branch_labels = None 1a

18depends_on = None 1a

19 

20 

21def upgrade(): 1a

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

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

24 batch_op.add_column( 1a

25 sa.Column( 

26 "created_by", 

27 prefect.server.utilities.database.Pydantic( 

28 prefect.server.schemas.core.CreatedBy 

29 ), 

30 nullable=True, 

31 ) 

32 ) 

33 batch_op.add_column( 1a

34 sa.Column( 

35 "updated_by", 

36 prefect.server.utilities.database.Pydantic( 

37 prefect.server.schemas.core.UpdatedBy 

38 ), 

39 nullable=True, 

40 ) 

41 ) 

42 

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

44 batch_op.add_column( 1a

45 sa.Column( 

46 "created_by", 

47 prefect.server.utilities.database.Pydantic( 

48 prefect.server.schemas.core.CreatedBy 

49 ), 

50 nullable=True, 

51 ) 

52 ) 

53 

54 # ### end Alembic commands ### 

55 

56 

57def downgrade(): 1a

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

59 with op.batch_alter_table("flow_run", schema=None) as batch_op: 

60 batch_op.drop_column("created_by") 

61 

62 with op.batch_alter_table("deployment", schema=None) as batch_op: 

63 batch_op.drop_column("updated_by") 

64 batch_op.drop_column("created_by") 

65 

66 # ### end Alembic commands ###