aboutsummaryrefslogtreecommitdiff
path: root/sqitch
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-07-11 10:44:59 +0100
committerChristopher Baines <mail@cbaines.net>2021-07-11 11:57:05 +0100
commitaf209170f7b3ea3e1d6539573cc5fc0255239ec5 (patch)
tree4a19703d7e80184dcd09ef50281e6d050563631e /sqitch
parentb4188bda9df04231f9dee9956a68daa049a71584 (diff)
downloaddata-service-af209170f7b3ea3e1d6539573cc5fc0255239ec5.tar
data-service-af209170f7b3ea3e1d6539573cc5fc0255239ec5.tar.gz
Track package replacements
Start at least looking for package replacements, and storing the details (particularly the derivation). I'm looking at doing this so that build servers using the Guix Data Service can build these derivations.
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;