"""Add leave_wish.window_mode ('fixed' | 'flexible'). PLANNING_ENGINE_SPEC.md §10.1 — "när det passar bäst" flexible wishes. For a 'flexible' wish the EXISTING window_start_*/window_end_* columns are reinterpreted as the bounding range the allocator searches within, rather than the exact placement; no new columns are needed for the bound itself. Defaults to 'fixed' so every existing row (and every existing construction site) keeps its current, unchanged meaning. Revision ID: 006 Revises: 005 Create Date: 2026-09-13 """ from __future__ import annotations from alembic import op revision: str = "006" down_revision: str | None = "005" branch_labels: str | None = None depends_on: str | None = None _UPGRADE_SQL = """ ALTER TABLE leave_wish ADD COLUMN window_mode TEXT NOT NULL DEFAULT 'fixed' CHECK (window_mode IN ('fixed','flexible')); """ _DOWNGRADE_SQL = """ ALTER TABLE leave_wish DROP COLUMN window_mode; """ def upgrade() -> None: from sqlalchemy import text for stmt in [s.strip() for s in _UPGRADE_SQL.split(";") if s.strip()]: op.execute(text(stmt)) def downgrade() -> None: from sqlalchemy import text for stmt in [s.strip() for s in _DOWNGRADE_SQL.split(";") if s.strip()]: op.execute(text(stmt))