Compare commits
2 Commits
87d5aea315
...
3e70de3a5a
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e70de3a5a | |||
| f42b452899 |
@@ -6,22 +6,3 @@ ALTER TABLE "Competition" ADD COLUMN "isTest" BOOLEAN NOT NULL DEFAULT false;
|
|||||||
|
|
||||||
-- Index for efficient test data filtering
|
-- Index for efficient test data filtering
|
||||||
CREATE INDEX "Competition_isTest_idx" ON "Competition"("isTest");
|
CREATE INDEX "Competition_isTest_idx" ON "Competition"("isTest");
|
||||||
|
|
||||||
-- Add provider field to AIUsageLog for cross-provider cost tracking
|
|
||||||
ALTER TABLE "AIUsageLog" ADD COLUMN "provider" TEXT;
|
|
||||||
|
|
||||||
-- Remove LOCALIZATION from SettingCategory enum
|
|
||||||
-- First delete any rows using this category to avoid FK constraint errors
|
|
||||||
DELETE FROM "SystemSettings" WHERE "category" = 'LOCALIZATION';
|
|
||||||
|
|
||||||
-- Remove the enum value (PostgreSQL does not support DROP VALUE directly,
|
|
||||||
-- so we recreate the enum type without the removed value)
|
|
||||||
-- Step 1: Create new enum without LOCALIZATION
|
|
||||||
CREATE TYPE "SettingCategory_new" AS ENUM ('AI', 'BRANDING', 'EMAIL', 'STORAGE', 'SECURITY', 'DEFAULTS', 'WHATSAPP', 'AUDIT_CONFIG', 'DIGEST', 'ANALYTICS', 'INTEGRATIONS', 'COMMUNICATION', 'FEATURE_FLAGS');
|
|
||||||
|
|
||||||
-- Step 2: Alter column to use new enum
|
|
||||||
ALTER TABLE "SystemSettings" ALTER COLUMN "category" TYPE "SettingCategory_new" USING ("category"::text::"SettingCategory_new");
|
|
||||||
|
|
||||||
-- Step 3: Drop old enum and rename new one
|
|
||||||
DROP TYPE "SettingCategory";
|
|
||||||
ALTER TYPE "SettingCategory_new" RENAME TO "SettingCategory";
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
-- Delete any existing LOCALIZATION settings
|
||||||
|
DELETE FROM "SystemSettings" WHERE category = 'LOCALIZATION';
|
||||||
|
|
||||||
|
-- Add provider field to AIUsageLog for cross-provider cost tracking
|
||||||
|
ALTER TABLE "AIUsageLog" ADD COLUMN "provider" TEXT;
|
||||||
|
|
||||||
|
-- Remove LOCALIZATION from SettingCategory enum
|
||||||
|
-- First create new enum without the value, then swap
|
||||||
|
CREATE TYPE "SettingCategory_new" AS ENUM ('AI', 'BRANDING', 'EMAIL', 'STORAGE', 'SECURITY', 'DEFAULTS', 'WHATSAPP', 'AUDIT_CONFIG', 'DIGEST', 'ANALYTICS', 'INTEGRATIONS', 'COMMUNICATION', 'FEATURE_FLAGS');
|
||||||
|
ALTER TABLE "SystemSettings" ALTER COLUMN "category" TYPE "SettingCategory_new" USING ("category"::text::"SettingCategory_new");
|
||||||
|
ALTER TYPE "SettingCategory" RENAME TO "SettingCategory_old";
|
||||||
|
ALTER TYPE "SettingCategory_new" RENAME TO "SettingCategory";
|
||||||
|
DROP TYPE "SettingCategory_old";
|
||||||
@@ -915,8 +915,8 @@ model AIUsageLog {
|
|||||||
entityId String?
|
entityId String?
|
||||||
|
|
||||||
// What was used
|
// What was used
|
||||||
provider String? // 'openai', 'anthropic', 'litellm'
|
|
||||||
model String // gpt-4o, gpt-4o-mini, o1, claude-sonnet-4-5, etc.
|
model String // gpt-4o, gpt-4o-mini, o1, claude-sonnet-4-5, etc.
|
||||||
|
provider String? // openai, anthropic, litellm
|
||||||
promptTokens Int
|
promptTokens Int
|
||||||
completionTokens Int
|
completionTokens Int
|
||||||
totalTokens Int
|
totalTokens Int
|
||||||
|
|||||||
Reference in New Issue
Block a user