"""Phase 11.1 — Sites & Page Resources schema."""
from alembic import op
from app.core.database import Base
import app.models  # noqa: F401

revision = "0002_phase_111_sites_pages"
down_revision = "0001_initial"
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 (
        "experience_site_domains",
        "experience_pages",
        "experience_sites",
    ):
        if table in Base.metadata.tables:
            Base.metadata.tables[table].drop(bind=bind, checkfirst=True)
