aboutsummaryrefslogtreecommitdiff
path: root/sqitch
diff options
context:
space:
mode:
Diffstat (limited to 'sqitch')
-rw-r--r--sqitch/deploy/load_new_guix_revision_jobs_make_commits_unique.sql31
-rw-r--r--sqitch/revert/load_new_guix_revision_jobs_make_commits_unique.sql7
-rw-r--r--sqitch/sqitch.plan1
-rw-r--r--sqitch/verify/load_new_guix_revision_jobs_make_commits_unique.sql7
4 files changed, 46 insertions, 0 deletions
diff --git a/sqitch/deploy/load_new_guix_revision_jobs_make_commits_unique.sql b/sqitch/deploy/load_new_guix_revision_jobs_make_commits_unique.sql
new file mode 100644
index 0000000..52ef2d3
--- /dev/null
+++ b/sqitch/deploy/load_new_guix_revision_jobs_make_commits_unique.sql
@@ -0,0 +1,31 @@
+-- Deploy guix-data-service:load_new_guix_revision_jobs_make_commits_unique to pg
+
+BEGIN;
+
+DROP INDEX load_new_guix_revision_jobs_commit_git_repository_id_idx;
+
+DELETE FROM load_new_guix_revision_job_events
+WHERE job_id NOT IN (
+ SELECT DISTINCT ON (commit) id
+ FROM load_new_guix_revision_jobs
+ ORDER BY commit, succeeded_at ASC NULLS LAST, created_at ASC
+)
+
+DELETE FROM load_new_guix_revision_job_logs
+WHERE job_id NOT IN (
+ SELECT DISTINCT ON (commit) id
+ FROM load_new_guix_revision_jobs
+ ORDER BY commit, succeeded_at ASC NULLS LAST, created_at ASC
+);
+
+DELETE FROM load_new_guix_revision_jobs
+WHERE id NOT IN (
+ SELECT DISTINCT ON (commit) id
+ FROM load_new_guix_revision_jobs
+ ORDER BY commit, succeeded_at ASC NULLS LAST, created_at ASC
+);
+
+CREATE UNIQUE INDEX load_new_guix_revision_jobs_commit_idx
+ ON load_new_guix_revision_jobs (commit);
+
+COMMIT;
diff --git a/sqitch/revert/load_new_guix_revision_jobs_make_commits_unique.sql b/sqitch/revert/load_new_guix_revision_jobs_make_commits_unique.sql
new file mode 100644
index 0000000..57db0bb
--- /dev/null
+++ b/sqitch/revert/load_new_guix_revision_jobs_make_commits_unique.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:load_new_guix_revision_jobs_make_commits_unique from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index e0c55c7..a92062c 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -55,3 +55,4 @@ make_some_constraints_deferrable 2020-02-16T10:54:22Z Christopher Baines <mail@c
guix_revision_system_test_derivations_add_system 2020-03-19T21:30:33Z Christopher Baines <mail@cbaines.net> # Add a system column to the guix_revision_system_test_derivations table
drop_package_versions_by_guix_revision_range 2020-03-24T20:40:38Z Christopher Baines <mail@cbaines.net> # Drop package_versions_by_guix_revision_range
create_narinfo_fetch_records_index 2020-03-25T19:07:28Z Christopher Baines <mail@cbaines.net> # Create an index on narinfo_fetch_records
+load_new_guix_revision_jobs_make_commits_unique 2020-03-27T21:38:42Z Christopher Baines <mail@cbaines.net> # Make load_new_guix_revision_jobs commits unique
diff --git a/sqitch/verify/load_new_guix_revision_jobs_make_commits_unique.sql b/sqitch/verify/load_new_guix_revision_jobs_make_commits_unique.sql
new file mode 100644
index 0000000..88be8f0
--- /dev/null
+++ b/sqitch/verify/load_new_guix_revision_jobs_make_commits_unique.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:load_new_guix_revision_jobs_make_commits_unique on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;