From 2b5b1e402b5d2a2da15296b889892bbb36bd111c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20D=C3=A9tr=C3=A9?= Date: Fri, 20 Dec 2024 17:08:48 +0100 Subject: [PATCH] fix: disable de tous les triggers pour la session de migration --- server/src/migrations/migration_1734618351550.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/migrations/migration_1734618351550.ts b/server/src/migrations/migration_1734618351550.ts index 281f78657..bcf3478d7 100644 --- a/server/src/migrations/migration_1734618351550.ts +++ b/server/src/migrations/migration_1734618351550.ts @@ -115,7 +115,11 @@ export const up = async (db: Kysely) => { sqlQuery += `UPDATE intention SET cfd = '${nouveauCFD}' WHERE cfd = '${ancienCFD}' AND id in (SELECT id FROM "latestIntentionView");\n`; }); + // disable les triggers qui utilisent trop de mémoire sur des opérations massives + await getKbdClient().executeQuery(sql`SET session_replication_role = replica;`.compile(db)); await getKbdClient().executeQuery(sql.raw(sqlQuery).compile(db)); + // enable les triggers + await getKbdClient().executeQuery(sql`SET session_replication_role = DEFAULT;`.compile(db)); await getKbdClient().executeQuery( sql`