gmao/migrations/versions/fg7b8c9d0e1f_backfill_intervention_workflows.py
root d1fef99def
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Classer les interventions existantes par workflow
2026-08-21 10:16:07 +00:00

16 lines
713 B
Python

"""Classe les interventions existantes par workflow."""
from alembic import op
import sqlalchemy as sa
revision = "fg7b8c9d0e1f"
down_revision = "ff6a7b8c9d0e"
branch_labels = None
depends_on = None
def upgrade():
op.execute(sa.text("UPDATE interventions SET workflow_type='preventive' WHERE type='preventif'"))
op.execute(sa.text("UPDATE interventions SET workflow_type='travaux' WHERE type='amelioratif'"))
op.execute(sa.text("UPDATE interventions SET workflow_type='prevention' WHERE type IN ('prevention','administratif','formation')"))
def downgrade():
op.execute(sa.text("UPDATE interventions SET workflow_type='corrective' WHERE workflow_type IN ('preventive','travaux','prevention')"))