fix: add migration for missing ai_settings columns

The original migration only created the table with id/userId/apiKey.
All provider keys, models, toggles, and feature flags were in the
schema but never added to the database, causing every AI settings
save to fail with a Prisma column-not-found error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gitead
2026-06-09 23:46:52 -04:00
parent facf9e79e2
commit 949e64c129
10 changed files with 111 additions and 16650 deletions

View File

@@ -0,0 +1,12 @@
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "aiEnabled" BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "openAiKey" TEXT NOT NULL DEFAULT '';
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "openAiEnabled" BOOLEAN NOT NULL DEFAULT false;
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "claudeAiKey" TEXT NOT NULL DEFAULT '';
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "claudeAiEnabled" BOOLEAN NOT NULL DEFAULT false;
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "claudeAiModel" TEXT NOT NULL DEFAULT 'claude-haiku-4-5-20251001';
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "openAiModel" TEXT NOT NULL DEFAULT 'gpt-5.2';
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "googleAiModel" TEXT NOT NULL DEFAULT 'gemini-2.5-flash';
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "dentalMgmtKey" TEXT NOT NULL DEFAULT '';
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "dentalMgmtEnabled" BOOLEAN NOT NULL DEFAULT false;
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "afterHoursEnabled" BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE "ai_settings" ADD COLUMN IF NOT EXISTS "openPhoneReply" BOOLEAN NOT NULL DEFAULT false;