fix(db): add missing Label.type and UserAISettings.autoSave columns
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled

These columns exist in schema.prisma but were never added via migration,
causing PrismaClientKnownRequestError on notebook/label queries in production.
Uses idempotent DO 4109514 IF NOT EXISTS 4109514 blocks to be safe on any DB state.
This commit is contained in:
Antigravity
2026-05-09 15:46:21 +00:00
parent 6cca5c5213
commit 5030204987

View File

@@ -0,0 +1,24 @@
-- Migration de rattrapage : colonnes présentes dans schema.prisma mais absentes de la DB
-- Label.type et UserAISettings.autoSave n'avaient pas de migration correspondante
-- AlterTable Label — ajoute la colonne type si elle n'existe pas déjà
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'Label' AND column_name = 'type'
) THEN
ALTER TABLE "Label" ADD COLUMN "type" TEXT NOT NULL DEFAULT 'user';
END IF;
END $$;
-- AlterTable UserAISettings — ajoute autoSave si elle n'existe pas déjà
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'UserAISettings' AND column_name = 'autoSave'
) THEN
ALTER TABLE "UserAISettings" ADD COLUMN "autoSave" BOOLEAN NOT NULL DEFAULT true;
END IF;
END $$;