Files
ai-gateway-go/migrations/000005_provider_models.sql
superidou 5759c1862e AI Gateway Go 0.10.0 源码快照 + 旗舰版需求规划报告
M0-M7 已完成:核心网关(身份/RBAC/TOTP/OIDC/SAML/Provider/配额/路由/内容策略/审计/定价)+ 资源市场(MCP/Skills/数字员工)。
含 22 个 PostgreSQL 迁移、管理端/门户端前端源码、OpenAPI 契约、部署 compose。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-12 11:45:54 +08:00

21 lines
910 B
SQL

CREATE TABLE IF NOT EXISTS gateway.provider_models (
id uuid PRIMARY KEY,
provider_id uuid NOT NULL REFERENCES gateway.providers(id) ON DELETE CASCADE,
provider_model_id text NOT NULL CHECK (
length(provider_model_id) BETWEEN 1 AND 512
),
owned_by text NOT NULL DEFAULT '',
metadata jsonb NOT NULL DEFAULT '{}'::jsonb,
enabled boolean NOT NULL DEFAULT true,
discovered_at timestamptz NOT NULL DEFAULT clock_timestamp(),
last_seen_at timestamptz NOT NULL DEFAULT clock_timestamp(),
updated_at timestamptz NOT NULL DEFAULT clock_timestamp(),
UNIQUE (provider_id, provider_model_id)
);
CREATE INDEX IF NOT EXISTS provider_models_provider_active_idx
ON gateway.provider_models (provider_id, enabled, provider_model_id);
COMMENT ON TABLE gateway.provider_models IS
'Provider model catalog snapshots. Missing upstream models are retained and disabled.';