aboutsummaryrefslogtreecommitdiff
path: root/sqitch/deploy
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-05-15 08:05:14 +0100
committerChristopher Baines <mail@cbaines.net>2019-05-15 08:05:14 +0100
commit16799a34a96bfa240b3eb47d75c935afab8c51a1 (patch)
treedb03a3f86bfaa69f5522e31504de1bd64576d6e8 /sqitch/deploy
parent28c2d4608149b55d7547eab563e688814f3d7254 (diff)
downloaddata-service-16799a34a96bfa240b3eb47d75c935afab8c51a1.tar
data-service-16799a34a96bfa240b3eb47d75c935afab8c51a1.tar.gz
Store license information for packages
And display this on the package page. This uses a couple of new tables, and an additional field in the package_metadata table. Currently, the order of the licenses in the package definition isn't stored, as I'm not sure the order in the list is significant.
Diffstat (limited to 'sqitch/deploy')
-rw-r--r--sqitch/deploy/license_support.sql27
1 files changed, 27 insertions, 0 deletions
diff --git a/sqitch/deploy/license_support.sql b/sqitch/deploy/license_support.sql
new file mode 100644
index 0000000..64e2708
--- /dev/null
+++ b/sqitch/deploy/license_support.sql
@@ -0,0 +1,27 @@
+-- Deploy guix-data-service:license_support to pg
+
+BEGIN;
+
+CREATE TABLE licenses (
+ id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
+ name character varying NOT NULL,
+ uri character varying,
+ comment character varying,
+ PRIMARY KEY(id),
+ UNIQUE (name, uri, comment)
+);
+
+CREATE TABLE license_sets (
+ id integer GENERATED ALWAYS AS IDENTITY,
+ license_ids integer[] NOT NULL,
+ PRIMARY KEY(license_ids),
+ UNIQUE (id)
+);
+
+ALTER TABLE package_metadata ADD COLUMN license_set_id integer REFERENCES license_sets(id);
+
+ALTER TABLE package_metadata DROP CONSTRAINT synopsis_description_home_page_location_id;
+
+ALTER TABLE package_metadata ADD CONSTRAINT package_metadata_unique_fields UNIQUE (synopsis, description, home_page, location_id, license_set_id);
+
+COMMIT;