aboutsummaryrefslogtreecommitdiff
path: root/sqitch
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-08-05 20:02:06 +0100
committerChristopher Baines <mail@cbaines.net>2019-08-05 20:02:06 +0100
commitf553a7490d215edf0d093bf4b5eee6c23440e916 (patch)
tree75e83575816ce7ddf8b1cfab2b8948fcaa3628a7 /sqitch
parent4b59108fdd320d32378cd1f31e9f394af52122ea (diff)
downloaddata-service-f553a7490d215edf0d093bf4b5eee6c23440e916.tar
data-service-f553a7490d215edf0d093bf4b5eee6c23440e916.tar.gz
Change the git_branches table primary key
To allow for having branches in multiple git repositories.
Diffstat (limited to 'sqitch')
-rw-r--r--sqitch/deploy/change_git_branches_primary_key.sql9
-rw-r--r--sqitch/revert/change_git_branches_primary_key.sql9
-rw-r--r--sqitch/sqitch.plan1
-rw-r--r--sqitch/verify/change_git_branches_primary_key.sql7
4 files changed, 26 insertions, 0 deletions
diff --git a/sqitch/deploy/change_git_branches_primary_key.sql b/sqitch/deploy/change_git_branches_primary_key.sql
new file mode 100644
index 0000000..af0ff80
--- /dev/null
+++ b/sqitch/deploy/change_git_branches_primary_key.sql
@@ -0,0 +1,9 @@
+-- Deploy guix-data-service:change_git_branches_primary_key to pg
+
+BEGIN;
+
+ALTER TABLE git_branches DROP CONSTRAINT name_commit;
+
+ALTER TABLE git_branches ADD PRIMARY KEY (name, commit, git_repository_id);
+
+COMMIT;
diff --git a/sqitch/revert/change_git_branches_primary_key.sql b/sqitch/revert/change_git_branches_primary_key.sql
new file mode 100644
index 0000000..9d548c3
--- /dev/null
+++ b/sqitch/revert/change_git_branches_primary_key.sql
@@ -0,0 +1,9 @@
+-- Revert guix-data-service:change_git_branches_primary_key from pg
+
+BEGIN;
+
+ALTER TABLE git_branches DROP CONSTRAINT git_branches_pkey;
+
+ALTER TABLE git_branches ADD PRIMARY KEY (name, commit);
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index bd513cc..e78dbac 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -16,3 +16,4 @@ load_new_guix_revision_job_events 2019-06-02T15:44:41Z Christopher Baines <mail@
load_new_guix_revision_job_logs 2019-06-21T14:33:09Z chris <chris@phact> # Add load_new_guix_revision_job_logs
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.
diff --git a/sqitch/verify/change_git_branches_primary_key.sql b/sqitch/verify/change_git_branches_primary_key.sql
new file mode 100644
index 0000000..db55981
--- /dev/null
+++ b/sqitch/verify/change_git_branches_primary_key.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:change_git_branches_primary_key on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;