"""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')"))
