Coverage for opt/mealie/lib/python3.12/site-packages/mealie/alembic/versions/2022-08-13-17.07.07_089bfa50d0ed_add_is_ocr_recipe_column_to_recipes.py: 91%
11 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 14:03 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 14:03 +0000
1"""Add is_ocr_recipe column to recipes
3Revision ID: 089bfa50d0ed
4Revises: 188374910655
5Create Date: 2022-08-05 17:07:07.389271
7"""
9import sqlalchemy as sa 1a
11from alembic import op 1a
13# revision identifiers, used by Alembic.
14revision = "089bfa50d0ed" 1a
15down_revision = "188374910655" 1a
16branch_labels: str | tuple[str, ...] | None = None 1a
17depends_on: str | tuple[str, ...] | None = None 1a
20def upgrade(): 1a
21 op.add_column("recipes", sa.Column("is_ocr_recipe", sa.Boolean(), default=False, nullable=True)) 1a
22 op.execute("UPDATE recipes SET is_ocr_recipe = FALSE") 1a
23 # SQLITE does not support ALTER COLUMN, so the column will stay nullable to prevent making this migration a mess
24 # The Recipe pydantic model and the SQL server use False as default value anyway for this column so Null should be a very rare sight
27def downgrade(): 1a
28 op.drop_column("recipes", "is_ocr_recipe")