Coverage for opt/mealie/lib/python3.12/site-packages/mealie/alembic/versions/2022-03-23-17.43.34_263dd6707191_convert_quantity_from_integer_to_float.py: 67%

14 statements  

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

1"""convert quantity from integer to float 

2 

3Revision ID: 263dd6707191 

4Revises: 6b0f5f32d602 

5Create Date: 2022-03-23 17:43:34.727829 

6 

7""" 

8 

9import sqlalchemy as sa 1a

10 

11from alembic import op 1a

12 

13# revision identifiers, used by Alembic. 

14revision = "263dd6707191" 1a

15down_revision = "6b0f5f32d602" 1a

16branch_labels: str | tuple[str, ...] | None = None 1a

17depends_on: str | tuple[str, ...] | None = None 1a

18 

19 

20def is_postgres(): 1a

21 return op.get_context().dialect.name == "postgresql" 1a

22 

23 

24def upgrade(): 1a

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

26 

27 # SQLite doesn't require migration as types are not enforced. 

28 # Postgres Specific Migration 

29 if is_postgres(): 29 ↛ 30line 29 didn't jump to line 30 because the condition on line 29 was never true1a

30 op.alter_column( 

31 "recipes_ingredients", 

32 "quantity", 

33 type_=sa.Float(), 

34 existing_type=sa.Integer(), 

35 ) 

36 # ### end Alembic commands ### 

37 

38 

39def downgrade(): 1a

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

41 

42 # SQLite doesn't require migration as types are not enforced. 

43 # Postgres Specific Migration 

44 if is_postgres(): 

45 op.alter_column( 

46 "recipes_ingredients", 

47 "quantity", 

48 type_=sa.Integer(), 

49 existing_type=sa.Float(), 

50 ) 

51 

52 # ### end Alembic commands ###