40 lines
1.8 KiB
SQL
40 lines
1.8 KiB
SQL
-- +goose Up
|
|
|
|
-- Single mutable configuration record — business requisites (for PDF
|
|
-- documents), the Gemini API key/model (AI intake/analytics/diagnosis), the
|
|
-- Telegram bot token/chat/base URL (staff notifications), and the IMEI
|
|
-- lookup API key. Singleton row (id=1, enforced by the CHECK constraint and
|
|
-- seeded exactly once below) rather than a key-value table — every field
|
|
-- here is "the one true value the whole app uses right now", the same
|
|
-- shape, so a real row keeps reads/writes trivial (no N+1, no dynamic key
|
|
-- parsing). Deliberately excludes true infrastructure secrets
|
|
-- (JWT_SECRET, DATABASE_URL, MINIO_*, CORE_URL/MODULE_TOKEN,
|
|
-- ONLINE_STORE_WEBHOOK_TOKEN) — those are how this process authenticates to
|
|
-- its own infrastructure (or would invalidate every session / break
|
|
-- inter-service auth if edited live through a web form) and stay .env, by
|
|
-- user decision. See internal/settings package doc for the env-var
|
|
-- fallback that keeps existing deployments working before an owner fills
|
|
-- these in.
|
|
CREATE TABLE settings (
|
|
id INT PRIMARY KEY DEFAULT 1 CHECK (id = 1),
|
|
business_name TEXT,
|
|
business_inn TEXT,
|
|
business_kpp TEXT,
|
|
business_address TEXT,
|
|
business_phone TEXT,
|
|
business_bank_name TEXT,
|
|
business_bank_account TEXT,
|
|
business_bank_bik TEXT,
|
|
business_bank_corr_account TEXT,
|
|
gemini_api_key TEXT,
|
|
gemini_model TEXT,
|
|
tg_bot_token TEXT,
|
|
tg_chat_id TEXT,
|
|
tg_api_base_url TEXT,
|
|
imei_api_key TEXT,
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_by_staff_name TEXT
|
|
);
|
|
|
|
INSERT INTO settings (id) VALUES (1);
|