"""Phase 11.7 — Publishing, SEO and PWA schema."""
from alembic import op

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

revision = "0008_phase_117_pub_seo_pwa"
down_revision = "0007_phase_116_forms_appts"
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_pwa_manifests",
        "experience_robots_shells",
        "experience_sitemap_shells",
        "experience_seo_metadata",
        "experience_domain_edge_bindings",
        "experience_publish_releases",
    ):
        if table in Base.metadata.tables:
            Base.metadata.tables[table].drop(bind=bind, checkfirst=True)
