-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor all Analytics Module's Postgres queries to replace
DELETE
…
…queries with `INSERT` and `SELECT` (#226) * Replace DELETE with INSERT * Fix sonar issues
- Loading branch information
Showing
5 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
DSL/Liquibase/changelog/1715604012-add-deleted-to-scheduled_reports.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- liquibase formatted sql | ||
-- changeset baha-a:1715604012 | ||
ALTER TABLE scheduled_reports | ||
ADD COLUMN IF NOT EXISTS deleted boolean NOT NULL DEFAULT FALSE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
DELETE FROM "configuration" | ||
WHERE "key" LIKE 'odp_%'; | ||
INSERT INTO configuration (key, value, deleted) | ||
SELECT | ||
key, | ||
NULL AS value, | ||
TRUE AS deleted | ||
FROM configuration | ||
WHERE key LIKE 'odp_%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
DELETE FROM scheduled_reports WHERE dataset_id = :id | ||
INSERT INTO scheduled_reports (name, period, metrics, dataset_id, start_date, end_date, deleted) | ||
SELECT | ||
name, | ||
period, | ||
metrics, | ||
dataset_id, | ||
start_date, | ||
end_date, | ||
TRUE | ||
FROM scheduled_reports | ||
WHERE dataset_id = :id | ||
ORDER BY id DESC | ||
LIMIT 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters