aboutsummaryrefslogtreecommitdiff
path: root/sqitch
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-08-05 20:59:48 +0100
committerChristopher Baines <mail@cbaines.net>2019-08-05 20:59:48 +0100
commit9e80bda4f91e06e3e1d60cf48d33534b7cabb626 (patch)
treeeca0240b347dfc7566553bfb312fff11feecba6e /sqitch
parent712dd377a1e972dd6a04d461b3d59ab8a279ae2f (diff)
downloaddata-service-9e80bda4f91e06e3e1d60cf48d33534b7cabb626.tar
data-service-9e80bda4f91e06e3e1d60cf48d33534b7cabb626.tar.gz
Avoid erroring when processing emails again
These changes allow processing emails again, and just creating job and branch entries where data is missing.
Diffstat (limited to 'sqitch')
-rw-r--r--sqitch/deploy/remove_duplicate_load_new_guix_revision_jobs.sql25
-rw-r--r--sqitch/revert/remove_duplicate_load_new_guix_revision_jobs.sql7
-rw-r--r--sqitch/sqitch.plan1
-rw-r--r--sqitch/verify/remove_duplicate_load_new_guix_revision_jobs.sql7
4 files changed, 40 insertions, 0 deletions
diff --git a/sqitch/deploy/remove_duplicate_load_new_guix_revision_jobs.sql b/sqitch/deploy/remove_duplicate_load_new_guix_revision_jobs.sql
new file mode 100644
index 0000000..4a5110e
--- /dev/null
+++ b/sqitch/deploy/remove_duplicate_load_new_guix_revision_jobs.sql
@@ -0,0 +1,25 @@
+-- Deploy guix-data-service:remove_duplicate_load_new_guix_revision_jobs to pg
+
+BEGIN;
+
+DELETE FROM load_new_guix_revision_job_events WHERE job_id NOT IN (
+ SELECT MIN(id) FROM load_new_guix_revision_jobs
+ GROUP BY commit, git_repository_id
+);
+
+DELETE FROM load_new_guix_revision_job_logs WHERE job_id NOT IN (
+ SELECT MIN(id) FROM load_new_guix_revision_jobs
+ GROUP BY commit, git_repository_id
+);
+
+DELETE FROM load_new_guix_revision_jobs WHERE id NOT IN (
+ SELECT MIN(id) FROM load_new_guix_revision_jobs
+ GROUP BY commit, git_repository_id
+);
+
+CREATE UNIQUE INDEX ON load_new_guix_revision_jobs (
+ commit,
+ git_repository_id
+);
+
+COMMIT;
diff --git a/sqitch/revert/remove_duplicate_load_new_guix_revision_jobs.sql b/sqitch/revert/remove_duplicate_load_new_guix_revision_jobs.sql
new file mode 100644
index 0000000..f35efed
--- /dev/null
+++ b/sqitch/revert/remove_duplicate_load_new_guix_revision_jobs.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:remove_duplicate_load_new_guix_revision_jobs from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index e78dbac..541074c 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -17,3 +17,4 @@ load_new_guix_revision_job_logs 2019-06-21T14:33:09Z chris <chris@phact> # Add l
change_load_new_guix_revision_job_logs_contents_to_be_nullable 2019-07-07T20:10:54Z Christopher Baines <mail@cbaines.net> # Change the contents field in the load_new_guix_revision_job_logs table\nto be nullable.\n\nwith '#' will # be ignored, and an empty message aborts the add. #\nChange to add: # #\nchange_load_new_guix_revision_job_logs_contents_to_be_nullable #\nsqitch/deploy/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql\nsqitch/revert/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql\nsqitch/verify/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql
fix_duplicated_licenses 2019-07-30T05:48:17Z Christopher Baines <mail@cbaines.net> # Fix duplicated licenses, and add constraints
change_git_branches_primary_key 2019-08-05T18:57:41Z Christopher Baines <mail@cbaines.net> # Change the git_branches primary key to include the git_repository_id,\nas this will allow having the same branch in different repositories.
+remove_duplicate_load_new_guix_revision_jobs 2019-08-05T19:06:36Z Christopher Baines <mail@cbaines.net> # Remove duplicate load_new_guix_revision_jobs
diff --git a/sqitch/verify/remove_duplicate_load_new_guix_revision_jobs.sql b/sqitch/verify/remove_duplicate_load_new_guix_revision_jobs.sql
new file mode 100644
index 0000000..3122c74
--- /dev/null
+++ b/sqitch/verify/remove_duplicate_load_new_guix_revision_jobs.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:remove_duplicate_load_new_guix_revision_jobs on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;