From 16799a34a96bfa240b3eb47d75c935afab8c51a1 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 15 May 2019 08:05:14 +0100 Subject: 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. --- sqitch/deploy/license_support.sql | 27 +++++++++++++++++++++++++++ sqitch/revert/license_support.sql | 9 +++++++++ sqitch/sqitch.plan | 1 + sqitch/verify/license_support.sql | 7 +++++++ 4 files changed, 44 insertions(+) create mode 100644 sqitch/deploy/license_support.sql create mode 100644 sqitch/revert/license_support.sql create mode 100644 sqitch/verify/license_support.sql (limited to 'sqitch') 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; diff --git a/sqitch/revert/license_support.sql b/sqitch/revert/license_support.sql new file mode 100644 index 0000000..703bf2f --- /dev/null +++ b/sqitch/revert/license_support.sql @@ -0,0 +1,9 @@ +-- Revert guix-data-service:license_support from pg + +BEGIN; + +DROP TABLE licenses; + +DROP TABLE license_sets; + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index 1898562..c8a7529 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -10,3 +10,4 @@ git_branches 2019-05-05T14:53:12Z Christopher Baines # Add a remove_package_metadata_sha1_hash 2019-05-12T10:37:40Z Christopher Baines # Remove the sha1_hash field from package_metadata add_location_information 2019-05-12T20:27:48Z Christopher Baines # Add locations table and location to package_metadata add_git_repositories_cgit_url_base 2019-05-13T18:45:14Z Christopher Baines # Add cgit_url_base to git_repositories +license_support 2019-05-13T20:37:40Z Christopher Baines # Add support for storing license information diff --git a/sqitch/verify/license_support.sql b/sqitch/verify/license_support.sql new file mode 100644 index 0000000..51377ed --- /dev/null +++ b/sqitch/verify/license_support.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:license_support on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- cgit v1.2.3