gmao/migrations/versions/f9c3d4e5f6a7_add_permanence_template.py

21 lines
790 B
Python
Raw Permalink Normal View History

"""Lie les permanences à un horaire type."""
from alembic import op
import sqlalchemy as sa
revision = "f9c3d4e5f6a7"
down_revision = "f8b2c3d4e5f6"
branch_labels = None
depends_on = None
def upgrade():
op.add_column("closure_work_days", sa.Column("template_id", sa.Integer(), nullable=True))
op.create_index("ix_closure_work_days_template_id", "closure_work_days", ["template_id"])
op.create_foreign_key("fk_closure_work_days_template_id", "closure_work_days", "work_schedule_templates", ["template_id"], ["id"])
def downgrade():
op.drop_constraint("fk_closure_work_days_template_id", "closure_work_days", type_="foreignkey")
op.drop_index("ix_closure_work_days_template_id", table_name="closure_work_days")
op.drop_column("closure_work_days", "template_id")