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.
25 lines
815 B
SQL
25 lines
815 B
SQL
-- 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 $$;
|