From 367a1afeabd6589158bada5947b7be0c778e9099 Mon Sep 17 00:00:00 2001 From: Blaize M Kaye Date: Mon, 8 Jan 2024 08:09:24 +1300 Subject: [PATCH] Adds insights cleanup for missing projects --- .../migrations/20231222000000_delete_orphaned_insights.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/api/database/migrations/20231222000000_delete_orphaned_insights.js b/services/api/database/migrations/20231222000000_delete_orphaned_insights.js index 7ca1d243f9..1f3a279b73 100644 --- a/services/api/database/migrations/20231222000000_delete_orphaned_insights.js +++ b/services/api/database/migrations/20231222000000_delete_orphaned_insights.js @@ -8,15 +8,15 @@ exports.up = function(knex) { DELETE ef FROM environment_fact ef LEFT JOIN environment e ON ef.environment = e.id - WHERE e.id IS NULL OR e.deleted != '0000-00-00 00:00:00' + WHERE e.id IS NULL OR e.deleted != '0000-00-00 00:00:00' OR e.project not in (select id from project) `), knex.schema.raw(` DELETE ep FROM environment_problem ep LEFT JOIN environment e ON ep.environment = e.id - WHERE e.id IS NULL OR e.deleted != '0000-00-00 00:00:00' + WHERE e.id IS NULL OR e.deleted != '0000-00-00 00:00:00' OR e.project not in (select id from project) `), -]); + ]); }; /**