Creates the vector extension plus id_user, id_user_identity, id_consent, bl_quota_rule, bl_quota, bl_ledger, tk_task and ob_ai_call using the domain prefixes of 架构文档 §6.1, and seeds the quota rules. Reversible: verified by an upgrade/downgrade/upgrade round-trip, which CI now runs on every push.
30 lines
721 B
Mako
Executable File
30 lines
721 B
Mako
Executable File
"""${message}
|
|
|
|
Revision ID: ${up_revision}
|
|
Revises: ${down_revision | comma,n}
|
|
Create Date: ${create_date}
|
|
|
|
Reversible: yes # 若不可逆必须改为 no 并在此说明原因 (架构文档 §16.2 迁移检查)
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Sequence
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
${imports if imports else ""}
|
|
|
|
revision: str = ${repr(up_revision)}
|
|
down_revision: str | None = ${repr(down_revision)}
|
|
branch_labels: str | Sequence[str] | None = ${repr(branch_labels)}
|
|
depends_on: str | Sequence[str] | None = ${repr(depends_on)}
|
|
|
|
|
|
def upgrade() -> None:
|
|
${upgrades if upgrades else "pass"}
|
|
|
|
|
|
def downgrade() -> None:
|
|
${downgrades if downgrades else "pass"}
|