"""Phase 11.8 — bundles, licensing refs and feature toggles."""
from alembic import op

from app.core.database import Base
import app.models  # noqa: F401

revision = "0009_phase_118_bundles_toggles"
down_revision = "0008_phase_117_pub_seo_pwa"
branch_labels = None
depends_on = None


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


def downgrade():
    bind = op.get_bind()
    for table in (
        "experience_feature_toggles",
        "experience_license_bindings",
        "experience_tenant_bundles",
        "experience_bundle_definitions",
    ):
        if table in Base.metadata.tables:
            Base.metadata.tables[table].drop(bind=bind, checkfirst=True)
