Files
2026-07-17 12:57:18 +03:00

34 lines
979 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""WESP 2.0: одна миграция для recipes.db и reports.db (переход с легаси 1.3).
Логика в app.schema_bootstrap.run_wesp20_idempotent_sync — та же выполняется после upgrade
в create_app (идемпотентно), чтобы схема догналась даже после alembic stamp без прогона.
Revision ID: wesp_2_0
Revises:
Create Date: 2026-04-19
"""
from __future__ import annotations
import os
from alembic import op
from app.schema_bootstrap import run_wesp20_idempotent_sync
revision = "wesp_2_0"
down_revision = None
branch_labels = None
depends_on = None
def upgrade(**kw) -> None:
run_wesp20_idempotent_sync(op, kw)
n = int(os.environ.get("WESP_MIGRATION_BODY_RAN_COUNT", "0") or "0")
os.environ["WESP_MIGRATION_BODY_RAN_COUNT"] = str(n + 1)
def downgrade(**kw) -> None:
"""Не поддерживается: откат к 1.3 только из бэкапа БД."""