Skip to content

Commit

Permalink
fix: disable de tous les triggers pour la session de migration
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasDetre committed Dec 20, 2024
1 parent b136e46 commit 2b5b1e4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/src/migrations/migration_1734618351550.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ export const up = async (db: Kysely<unknown>) => {
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`
Expand Down

0 comments on commit 2b5b1e4

Please sign in to comment.