From 5030204987acc0dd65a51b65a77b07d2a50b347e Mon Sep 17 00:00:00 2001 From: Antigravity Date: Sat, 9 May 2026 15:46:21 +0000 Subject: [PATCH] fix(db): add missing Label.type and UserAISettings.autoSave columns 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. --- .../migration.sql | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 memento-note/prisma/migrations/20260509160000_add_missing_columns/migration.sql diff --git a/memento-note/prisma/migrations/20260509160000_add_missing_columns/migration.sql b/memento-note/prisma/migrations/20260509160000_add_missing_columns/migration.sql new file mode 100644 index 0000000..23deef2 --- /dev/null +++ b/memento-note/prisma/migrations/20260509160000_add_missing_columns/migration.sql @@ -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 $$;