fix: sync canonical schema with 0061 migration to fix sqlc column mismatch

0001_init.up.sql still used old names (llm_providers, llm_provider_id)
and included dropped tts_providers/tts_models tables. sqlc could not
parse the PL/pgSQL EXECUTE in migration 0061, so generated code retained
stale columns (input_modalities, supports_reasoning) causing runtime
"column does not exist" errors when adding models.

- Update 0001_init.up.sql to current schema (providers, provider_id,
  no tts tables, add provider_oauth_tokens)
- Use ALTER TABLE IF EXISTS in 0010/0041/0042 for backward compat
- Regenerate sqlc
This commit is contained in:
Acbox
2026-04-08 00:45:06 +08:00
parent b71df81d5c
commit 889b6dbaa4
6 changed files with 109 additions and 126 deletions
+25 -34
View File
@@ -57,19 +57,18 @@ CREATE TABLE IF NOT EXISTS user_channel_bindings (
CREATE INDEX IF NOT EXISTS idx_user_channel_bindings_user_id ON user_channel_bindings(user_id);
CREATE TABLE IF NOT EXISTS llm_providers (
CREATE TABLE IF NOT EXISTS providers (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
base_url TEXT NOT NULL,
api_key TEXT NOT NULL,
client_type TEXT NOT NULL DEFAULT 'openai-completions',
icon TEXT,
enable BOOLEAN NOT NULL DEFAULT true,
config JSONB NOT NULL DEFAULT '{}'::jsonb,
metadata JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
CONSTRAINT llm_providers_name_unique UNIQUE (name),
CONSTRAINT llm_providers_client_type_check CHECK (client_type IN ('openai-responses', 'openai-completions', 'anthropic-messages', 'google-generative-ai', 'openai-codex'))
CONSTRAINT providers_name_unique UNIQUE (name),
CONSTRAINT providers_client_type_check CHECK (client_type IN ('openai-responses', 'openai-completions', 'anthropic-messages', 'google-generative-ai', 'openai-codex', 'edge-speech'))
);
CREATE TABLE IF NOT EXISTS search_providers (
@@ -87,13 +86,13 @@ CREATE TABLE IF NOT EXISTS models (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
model_id TEXT NOT NULL,
name TEXT,
llm_provider_id UUID NOT NULL REFERENCES llm_providers(id) ON DELETE CASCADE,
provider_id UUID NOT NULL REFERENCES providers(id) ON DELETE CASCADE,
type TEXT NOT NULL DEFAULT 'chat',
config JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
CONSTRAINT models_provider_model_id_unique UNIQUE (llm_provider_id, model_id),
CONSTRAINT models_type_check CHECK (type IN ('chat', 'embedding'))
CONSTRAINT models_provider_id_model_id_unique UNIQUE (provider_id, model_id),
CONSTRAINT models_type_check CHECK (type IN ('chat', 'embedding', 'speech'))
);
CREATE TABLE IF NOT EXISTS model_variants (
@@ -120,31 +119,6 @@ CREATE TABLE IF NOT EXISTS memory_providers (
CONSTRAINT memory_providers_name_unique UNIQUE (name)
);
-- tts_providers: pluggable TTS service backends
CREATE TABLE IF NOT EXISTS tts_providers (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
provider TEXT NOT NULL,
config JSONB NOT NULL DEFAULT '{}'::jsonb,
enable BOOLEAN NOT NULL DEFAULT false,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
CONSTRAINT tts_providers_name_unique UNIQUE (name)
);
-- tts_models: available models per TTS provider with per-model configuration
CREATE TABLE IF NOT EXISTS tts_models (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
model_id TEXT NOT NULL,
name TEXT,
tts_provider_id UUID NOT NULL REFERENCES tts_providers(id) ON DELETE CASCADE,
config JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_tts_models_provider_id ON tts_models(tts_provider_id);
CREATE TABLE IF NOT EXISTS browser_contexts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL DEFAULT '',
@@ -179,7 +153,7 @@ CREATE TABLE IF NOT EXISTS bots (
title_model_id UUID REFERENCES models(id) ON DELETE SET NULL,
image_model_id UUID REFERENCES models(id) ON DELETE SET NULL,
discuss_probe_model_id UUID REFERENCES models(id) ON DELETE SET NULL,
tts_model_id UUID REFERENCES tts_models(id) ON DELETE SET NULL,
tts_model_id UUID REFERENCES models(id) ON DELETE SET NULL,
browser_context_id UUID REFERENCES browser_contexts(id) ON DELETE SET NULL,
metadata JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
@@ -651,3 +625,20 @@ CREATE TABLE IF NOT EXISTS email_outbox (
CREATE INDEX IF NOT EXISTS idx_email_outbox_provider_id ON email_outbox(provider_id);
CREATE INDEX IF NOT EXISTS idx_email_outbox_bot_id ON email_outbox(bot_id, created_at DESC);
-- provider_oauth_tokens: OAuth2 tokens for LLM providers (e.g. OpenAI Codex OAuth)
CREATE TABLE IF NOT EXISTS provider_oauth_tokens (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
provider_id UUID NOT NULL UNIQUE REFERENCES providers(id) ON DELETE CASCADE,
access_token TEXT NOT NULL DEFAULT '',
refresh_token TEXT NOT NULL DEFAULT '',
expires_at TIMESTAMPTZ,
scope TEXT NOT NULL DEFAULT '',
token_type TEXT NOT NULL DEFAULT '',
state TEXT NOT NULL DEFAULT '',
pkce_code_verifier TEXT NOT NULL DEFAULT '',
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_provider_oauth_tokens_state ON provider_oauth_tokens(state) WHERE state != '';
@@ -43,6 +43,6 @@ BEGIN
END IF;
END $$;
-- 7) Drop client_type from llm_providers
ALTER TABLE llm_providers DROP CONSTRAINT IF EXISTS llm_providers_client_type_check;
ALTER TABLE llm_providers DROP COLUMN IF EXISTS client_type;
-- 7) Drop client_type from llm_providers (IF EXISTS for fresh-schema compat)
ALTER TABLE IF EXISTS llm_providers DROP CONSTRAINT IF EXISTS llm_providers_client_type_check;
ALTER TABLE IF EXISTS llm_providers DROP COLUMN IF EXISTS client_type;
@@ -1,8 +1,8 @@
-- 0041_provider_model_refactor
-- Move client_type to llm_providers, add icon, replace model columns with config JSONB.
-- 1. Add client_type and icon to llm_providers
ALTER TABLE llm_providers
-- 1. Add client_type and icon to llm_providers (IF EXISTS for fresh-schema compat)
ALTER TABLE IF EXISTS llm_providers
ADD COLUMN IF NOT EXISTS client_type TEXT NOT NULL DEFAULT 'openai-completions',
ADD COLUMN IF NOT EXISTS icon TEXT;
+1 -1
View File
@@ -1,5 +1,5 @@
-- 0042_provider_enable
-- Add enable column to llm_providers for built-in provider registry support.
ALTER TABLE llm_providers
ALTER TABLE IF EXISTS llm_providers
ADD COLUMN IF NOT EXISTS enable BOOLEAN NOT NULL DEFAULT true;
+42 -10
View File
@@ -298,6 +298,20 @@ type LifecycleEvent struct {
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type LlmProviderOauthToken struct {
ID pgtype.UUID `json:"id"`
LlmProviderID pgtype.UUID `json:"llm_provider_id"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
Scope string `json:"scope"`
TokenType string `json:"token_type"`
State string `json:"state"`
PkceCodeVerifier string `json:"pkce_code_verifier"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type McpConnection struct {
ID pgtype.UUID `json:"id"`
BotID pgtype.UUID `json:"bot_id"`
@@ -366,16 +380,14 @@ type MemoryProvider struct {
}
type Model struct {
ID pgtype.UUID `json:"id"`
ModelID string `json:"model_id"`
Name pgtype.Text `json:"name"`
ProviderID pgtype.UUID `json:"provider_id"`
Type string `json:"type"`
Config []byte `json:"config"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
InputModalities []string `json:"input_modalities"`
SupportsReasoning bool `json:"supports_reasoning"`
ID pgtype.UUID `json:"id"`
ModelID string `json:"model_id"`
Name pgtype.Text `json:"name"`
ProviderID pgtype.UUID `json:"provider_id"`
Type string `json:"type"`
Config []byte `json:"config"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type ModelVariant struct {
@@ -472,6 +484,26 @@ type StorageProvider struct {
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type TtsModel struct {
ID pgtype.UUID `json:"id"`
ModelID string `json:"model_id"`
Name pgtype.Text `json:"name"`
TtsProviderID pgtype.UUID `json:"tts_provider_id"`
Config []byte `json:"config"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type TtsProvider struct {
ID pgtype.UUID `json:"id"`
Name string `json:"name"`
Provider string `json:"provider"`
Config []byte `json:"config"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
Enable bool `json:"enable"`
}
type User struct {
ID pgtype.UUID `json:"id"`
Username pgtype.Text `json:"username"`
+36 -76
View File
@@ -53,7 +53,7 @@ VALUES (
$4,
$5
)
RETURNING id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning
RETURNING id, model_id, name, provider_id, type, config, created_at, updated_at
`
type CreateModelParams struct {
@@ -82,8 +82,6 @@ func (q *Queries) CreateModel(ctx context.Context, arg CreateModelParams) (Model
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
)
return i, err
}
@@ -200,7 +198,7 @@ func (q *Queries) DeleteProvider(ctx context.Context, id pgtype.UUID) error {
}
const getModelByID = `-- name: GetModelByID :one
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning FROM models WHERE id = $1
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at FROM models WHERE id = $1
`
func (q *Queries) GetModelByID(ctx context.Context, id pgtype.UUID) (Model, error) {
@@ -215,14 +213,12 @@ func (q *Queries) GetModelByID(ctx context.Context, id pgtype.UUID) (Model, erro
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
)
return i, err
}
const getModelByModelID = `-- name: GetModelByModelID :one
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning FROM models WHERE model_id = $1
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at FROM models WHERE model_id = $1
`
func (q *Queries) GetModelByModelID(ctx context.Context, modelID string) (Model, error) {
@@ -237,14 +233,12 @@ func (q *Queries) GetModelByModelID(ctx context.Context, modelID string) (Model,
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
)
return i, err
}
const getModelByProviderAndModelID = `-- name: GetModelByProviderAndModelID :one
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning FROM models
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at FROM models
WHERE provider_id = $1
AND model_id = $2
LIMIT 1
@@ -267,8 +261,6 @@ func (q *Queries) GetModelByProviderAndModelID(ctx context.Context, arg GetModel
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
)
return i, err
}
@@ -317,7 +309,7 @@ func (q *Queries) GetProviderByName(ctx context.Context, name string) (Provider,
const getSpeechModelWithProvider = `-- name: GetSpeechModelWithProvider :one
SELECT
m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at, m.input_modalities, m.supports_reasoning,
m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at,
p.client_type AS provider_type
FROM models m
JOIN providers p ON p.id = m.provider_id
@@ -326,17 +318,15 @@ WHERE m.id = $1
`
type GetSpeechModelWithProviderRow struct {
ID pgtype.UUID `json:"id"`
ModelID string `json:"model_id"`
Name pgtype.Text `json:"name"`
ProviderID pgtype.UUID `json:"provider_id"`
Type string `json:"type"`
Config []byte `json:"config"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
InputModalities []string `json:"input_modalities"`
SupportsReasoning bool `json:"supports_reasoning"`
ProviderType string `json:"provider_type"`
ID pgtype.UUID `json:"id"`
ModelID string `json:"model_id"`
Name pgtype.Text `json:"name"`
ProviderID pgtype.UUID `json:"provider_id"`
Type string `json:"type"`
Config []byte `json:"config"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
ProviderType string `json:"provider_type"`
}
func (q *Queries) GetSpeechModelWithProvider(ctx context.Context, id pgtype.UUID) (GetSpeechModelWithProviderRow, error) {
@@ -351,15 +341,13 @@ func (q *Queries) GetSpeechModelWithProvider(ctx context.Context, id pgtype.UUID
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
&i.ProviderType,
)
return i, err
}
const listEnabledModels = `-- name: ListEnabledModels :many
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at, m.input_modalities, m.supports_reasoning
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at
FROM models m
JOIN providers p ON m.provider_id = p.id
WHERE p.enable = true
@@ -384,8 +372,6 @@ func (q *Queries) ListEnabledModels(ctx context.Context) ([]Model, error) {
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -398,7 +384,7 @@ func (q *Queries) ListEnabledModels(ctx context.Context) ([]Model, error) {
}
const listEnabledModelsByProviderClientType = `-- name: ListEnabledModelsByProviderClientType :many
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at, m.input_modalities, m.supports_reasoning
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at
FROM models m
JOIN providers p ON m.provider_id = p.id
WHERE p.enable = true
@@ -424,8 +410,6 @@ func (q *Queries) ListEnabledModelsByProviderClientType(ctx context.Context, cli
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -438,7 +422,7 @@ func (q *Queries) ListEnabledModelsByProviderClientType(ctx context.Context, cli
}
const listEnabledModelsByType = `-- name: ListEnabledModelsByType :many
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at, m.input_modalities, m.supports_reasoning
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at
FROM models m
JOIN providers p ON m.provider_id = p.id
WHERE p.enable = true
@@ -464,8 +448,6 @@ func (q *Queries) ListEnabledModelsByType(ctx context.Context, type_ string) ([]
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -512,7 +494,7 @@ func (q *Queries) ListModelVariantsByModelUUID(ctx context.Context, modelUuid pg
}
const listModels = `-- name: ListModels :many
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning FROM models
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at FROM models
ORDER BY created_at DESC
`
@@ -534,8 +516,6 @@ func (q *Queries) ListModels(ctx context.Context) ([]Model, error) {
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -548,7 +528,7 @@ func (q *Queries) ListModels(ctx context.Context) ([]Model, error) {
}
const listModelsByModelID = `-- name: ListModelsByModelID :many
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning FROM models
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at FROM models
WHERE model_id = $1
ORDER BY created_at DESC
`
@@ -571,8 +551,6 @@ func (q *Queries) ListModelsByModelID(ctx context.Context, modelID string) ([]Mo
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -585,7 +563,7 @@ func (q *Queries) ListModelsByModelID(ctx context.Context, modelID string) ([]Mo
}
const listModelsByProviderClientType = `-- name: ListModelsByProviderClientType :many
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at, m.input_modalities, m.supports_reasoning
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at
FROM models m
JOIN providers p ON m.provider_id = p.id
WHERE p.client_type = $1
@@ -610,8 +588,6 @@ func (q *Queries) ListModelsByProviderClientType(ctx context.Context, clientType
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -624,7 +600,7 @@ func (q *Queries) ListModelsByProviderClientType(ctx context.Context, clientType
}
const listModelsByProviderID = `-- name: ListModelsByProviderID :many
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning FROM models
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at FROM models
WHERE provider_id = $1
ORDER BY created_at DESC
`
@@ -647,8 +623,6 @@ func (q *Queries) ListModelsByProviderID(ctx context.Context, providerID pgtype.
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -661,7 +635,7 @@ func (q *Queries) ListModelsByProviderID(ctx context.Context, providerID pgtype.
}
const listModelsByProviderIDAndType = `-- name: ListModelsByProviderIDAndType :many
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning FROM models
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at FROM models
WHERE provider_id = $1
AND type = $2
ORDER BY created_at DESC
@@ -690,8 +664,6 @@ func (q *Queries) ListModelsByProviderIDAndType(ctx context.Context, arg ListMod
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -704,7 +676,7 @@ func (q *Queries) ListModelsByProviderIDAndType(ctx context.Context, arg ListMod
}
const listModelsByType = `-- name: ListModelsByType :many
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning FROM models
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at FROM models
WHERE type = $1
ORDER BY created_at DESC
`
@@ -727,8 +699,6 @@ func (q *Queries) ListModelsByType(ctx context.Context, type_ string) ([]Model,
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -777,7 +747,7 @@ func (q *Queries) ListProviders(ctx context.Context) ([]Provider, error) {
}
const listSpeechModels = `-- name: ListSpeechModels :many
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at, m.input_modalities, m.supports_reasoning,
SELECT m.id, m.model_id, m.name, m.provider_id, m.type, m.config, m.created_at, m.updated_at,
p.client_type AS provider_type
FROM models m
JOIN providers p ON p.id = m.provider_id
@@ -786,17 +756,15 @@ ORDER BY m.created_at DESC
`
type ListSpeechModelsRow struct {
ID pgtype.UUID `json:"id"`
ModelID string `json:"model_id"`
Name pgtype.Text `json:"name"`
ProviderID pgtype.UUID `json:"provider_id"`
Type string `json:"type"`
Config []byte `json:"config"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
InputModalities []string `json:"input_modalities"`
SupportsReasoning bool `json:"supports_reasoning"`
ProviderType string `json:"provider_type"`
ID pgtype.UUID `json:"id"`
ModelID string `json:"model_id"`
Name pgtype.Text `json:"name"`
ProviderID pgtype.UUID `json:"provider_id"`
Type string `json:"type"`
Config []byte `json:"config"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
ProviderType string `json:"provider_type"`
}
func (q *Queries) ListSpeechModels(ctx context.Context) ([]ListSpeechModelsRow, error) {
@@ -817,8 +785,6 @@ func (q *Queries) ListSpeechModels(ctx context.Context) ([]ListSpeechModelsRow,
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
&i.ProviderType,
); err != nil {
return nil, err
@@ -832,7 +798,7 @@ func (q *Queries) ListSpeechModels(ctx context.Context) ([]ListSpeechModelsRow,
}
const listSpeechModelsByProviderID = `-- name: ListSpeechModelsByProviderID :many
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning FROM models
SELECT id, model_id, name, provider_id, type, config, created_at, updated_at FROM models
WHERE provider_id = $1
AND type = 'speech'
ORDER BY created_at DESC
@@ -856,8 +822,6 @@ func (q *Queries) ListSpeechModelsByProviderID(ctx context.Context, providerID p
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
); err != nil {
return nil, err
}
@@ -915,7 +879,7 @@ SET
config = $5,
updated_at = now()
WHERE id = $6
RETURNING id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning
RETURNING id, model_id, name, provider_id, type, config, created_at, updated_at
`
type UpdateModelParams struct {
@@ -946,8 +910,6 @@ func (q *Queries) UpdateModel(ctx context.Context, arg UpdateModelParams) (Model
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
)
return i, err
}
@@ -1009,7 +971,7 @@ ON CONFLICT (provider_id, model_id) DO UPDATE SET
type = EXCLUDED.type,
config = EXCLUDED.config,
updated_at = now()
RETURNING id, model_id, name, provider_id, type, config, created_at, updated_at, input_modalities, supports_reasoning
RETURNING id, model_id, name, provider_id, type, config, created_at, updated_at
`
type UpsertRegistryModelParams struct {
@@ -1038,8 +1000,6 @@ func (q *Queries) UpsertRegistryModel(ctx context.Context, arg UpsertRegistryMod
&i.Config,
&i.CreatedAt,
&i.UpdatedAt,
&i.InputModalities,
&i.SupportsReasoning,
)
return i, err
}