21 lines
1013 B
SQL
21 lines
1013 B
SQL
|
|
-- =====================================================================
|
||
|
|
-- CONTENT SCHEMA — Part 17: AI settings (per-tenant OpenAI config)
|
||
|
|
-- Stores the OpenAI (or OpenAI-compatible) API credentials used by the
|
||
|
|
-- AI SEO content generator. One row per tenant; api_key is stored as-is
|
||
|
|
-- (self-hosted) and never returned in full to clients (masked in the API).
|
||
|
|
-- base_url is configurable so deployments behind a proxy / in restricted
|
||
|
|
-- networks can point at a reachable OpenAI-compatible endpoint.
|
||
|
|
-- =====================================================================
|
||
|
|
|
||
|
|
SET search_path TO content, public;
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS ai_settings (
|
||
|
|
tenant_id UUID PRIMARY KEY,
|
||
|
|
provider TEXT NOT NULL DEFAULT 'openai',
|
||
|
|
api_key TEXT,
|
||
|
|
base_url TEXT NOT NULL DEFAULT 'https://api.openai.com/v1',
|
||
|
|
model TEXT NOT NULL DEFAULT 'gpt-4o-mini',
|
||
|
|
enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
||
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||
|
|
);
|