"""Phase 9.4 — Scheduling & Booking schema."""
from alembic import op
import sqlalchemy as sa
from app.core.database import Base
import app.models  # noqa: F401

revision = "0005_phase_94_booking"
down_revision = "0004_phase_93_coach_staff"
branch_labels = None
depends_on = None


def upgrade():
    bind = op.get_bind()
    Base.metadata.create_all(bind=bind)


def downgrade():
    bind = op.get_bind()
    for table in (
        "resource_reservations",
        "waiting_list_entries",
        "bookings",
        "sports_sessions",
        "equipment",
    ):
        if sa.inspect(bind).has_table(table):
            op.drop_table(table)
