aboutsummaryrefslogtreecommitdiff
path: root/sqitch
diff options
context:
space:
mode:
Diffstat (limited to 'sqitch')
-rw-r--r--sqitch/deploy/packages_replacement.sql16
-rw-r--r--sqitch/revert/packages_replacement.sql7
-rw-r--r--sqitch/sqitch.plan1
-rw-r--r--sqitch/verify/packages_replacement.sql7
4 files changed, 31 insertions, 0 deletions
diff --git a/sqitch/deploy/packages_replacement.sql b/sqitch/deploy/packages_replacement.sql
new file mode 100644
index 0000000..95df32a
--- /dev/null
+++ b/sqitch/deploy/packages_replacement.sql
@@ -0,0 +1,16 @@
+-- Deploy guix-data-service:packages_replacement to pg
+
+BEGIN;
+
+ALTER TABLE packages
+ ADD COLUMN replacement_package_id integer REFERENCES packages (id);
+
+ALTER TABLE packages DROP CONSTRAINT packages_pkey;
+ALTER TABLE packages ADD PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX packages_not_null_replacement_package_id_idx
+ ON packages (name, version, package_metadata_id, replacement_package_id);
+CREATE UNIQUE INDEX packages_null_replacement_package_id_idx
+ ON packages (name, version, package_metadata_id) WHERE replacement_package_id IS NULL;
+
+COMMIT;
diff --git a/sqitch/revert/packages_replacement.sql b/sqitch/revert/packages_replacement.sql
new file mode 100644
index 0000000..e3216e2
--- /dev/null
+++ b/sqitch/revert/packages_replacement.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:packages_replacement from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index db4bac9..10a3fe1 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -81,3 +81,4 @@ remove_guix_revisions_store_path 2021-02-02T20:06:18Z Christopher Baines <mail@c
systems_table 2021-04-22T08:12:10Z Christopher Baines <mail@cbaines.net> # Add a systems table
some_indexes 2021-05-17T17:36:38Z Christopher Baines <mail@cbaines.net> # Add some indexes
package_metadata_location_id_index 2021-05-27T19:51:13Z Canan Talayhan <canan.t.talayhan@gmail.com> # Add index for location id
+packages_replacement 2021-04-24T04:52:57Z Christopher Baines <mail@cbaines.net> # Add packages.replacement_package_id
diff --git a/sqitch/verify/packages_replacement.sql b/sqitch/verify/packages_replacement.sql
new file mode 100644
index 0000000..a0deb6d
--- /dev/null
+++ b/sqitch/verify/packages_replacement.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:packages_replacement on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;