"""baseline：建全部表（平台 + 培训 + 园区，唯一总库）

Revision ID: 0001_initial
Revises:
Create Date: 2026-08-24
"""
from __future__ import annotations

import sys
import os
from alembic import op

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))

revision = "0001_initial"
down_revision = None
branch_labels = None
depends_on = None


def upgrade() -> None:
    # 幂等：create_all 只建缺失的表。既有的平台表保留，新增培训/园区表被创建。
    from app.infrastructure.db import Base
    import app.infrastructure.models  # noqa: F401  注册全部模型
    Base.metadata.create_all(bind=op.get_bind())


def downgrade() -> None:
    from app.infrastructure.db import Base
    import app.infrastructure.models  # noqa: F401
    Base.metadata.drop_all(bind=op.get_bind())
