Skip to content

Commit

Permalink
Merge pull request #516 from mission-apprentissage/fix/triggers-migra…
Browse files Browse the repository at this point in the history
…tions-CS-MC

fix: disable de tous les triggers pour la session de migration
  • Loading branch information
LucasDetre authored Dec 20, 2024
2 parents b136e46 + 2b5b1e4 commit 7db9fa0
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 7db9fa0

Please sign in to comment.