From 7341d1725420b431160536c1cf2b34a662ff0a86 Mon Sep 17 00:00:00 2001
From: Christopher Baines <mail@cbaines.net>
Date: Mon, 13 May 2019 21:02:53 +0100
Subject: Store and display the location of packages

Store the location a package can be found at, and display this on the package
page.

If available, link off to the git repository containing the package.
---
 sqitch/deploy/add_git_repositories_cgit_url_base.sql |  7 +++++++
 sqitch/deploy/add_location_information.sql           | 20 ++++++++++++++++++++
 sqitch/revert/add_git_repositories_cgit_url_base.sql |  7 +++++++
 sqitch/revert/add_location_information.sql           |  7 +++++++
 sqitch/sqitch.plan                                   |  2 ++
 sqitch/verify/add_git_repositories_cgit_url_base.sql |  7 +++++++
 sqitch/verify/add_location_information.sql           |  7 +++++++
 7 files changed, 57 insertions(+)
 create mode 100644 sqitch/deploy/add_git_repositories_cgit_url_base.sql
 create mode 100644 sqitch/deploy/add_location_information.sql
 create mode 100644 sqitch/revert/add_git_repositories_cgit_url_base.sql
 create mode 100644 sqitch/revert/add_location_information.sql
 create mode 100644 sqitch/verify/add_git_repositories_cgit_url_base.sql
 create mode 100644 sqitch/verify/add_location_information.sql

(limited to 'sqitch')

diff --git a/sqitch/deploy/add_git_repositories_cgit_url_base.sql b/sqitch/deploy/add_git_repositories_cgit_url_base.sql
new file mode 100644
index 0000000..7a2d532
--- /dev/null
+++ b/sqitch/deploy/add_git_repositories_cgit_url_base.sql
@@ -0,0 +1,7 @@
+-- Deploy guix-data-service:add_git_repositories_cgit_url_base to pg
+
+BEGIN;
+
+ALTER TABLE git_repositories ADD COLUMN cgit_url_base character varying;
+
+COMMIT;
diff --git a/sqitch/deploy/add_location_information.sql b/sqitch/deploy/add_location_information.sql
new file mode 100644
index 0000000..7855feb
--- /dev/null
+++ b/sqitch/deploy/add_location_information.sql
@@ -0,0 +1,20 @@
+-- Deploy guix-data-service:add_location_information to pg
+
+BEGIN;
+
+CREATE TABLE locations (
+    id integer GENERATED BY DEFAULT AS IDENTITY,
+    file character varying NOT NULL,
+    line integer NOT NULL,
+    column_number integer NOT NULL,
+    CONSTRAINT file_line_column PRIMARY KEY(file, line, column_number),
+    UNIQUE (id)
+);
+
+ALTER TABLE package_metadata ADD COLUMN location_id integer REFERENCES locations(id);
+
+ALTER TABLE package_metadata DROP CONSTRAINT synopsis_description_home_page;
+
+ALTER TABLE package_metadata ADD CONSTRAINT synopsis_description_home_page_location_id UNIQUE (synopsis, description, home_page, location_id);
+
+COMMIT;
diff --git a/sqitch/revert/add_git_repositories_cgit_url_base.sql b/sqitch/revert/add_git_repositories_cgit_url_base.sql
new file mode 100644
index 0000000..67c5a87
--- /dev/null
+++ b/sqitch/revert/add_git_repositories_cgit_url_base.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:add_git_repositories_cgit_url_base from pg
+
+BEGIN;
+
+ALTER TABLE git_repositories DROP COLUMN cgit_url_base;
+
+COMMIT;
diff --git a/sqitch/revert/add_location_information.sql b/sqitch/revert/add_location_information.sql
new file mode 100644
index 0000000..31220ed
--- /dev/null
+++ b/sqitch/revert/add_location_information.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:add_location_information from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index 026aa7f..1898562 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -8,3 +8,5 @@ initial_import 2019-04-13T13:06:28Z Christopher Baines <mail@cbaines.net> # Impo
 git_repositories 2019-05-04T19:03:38Z Christopher Baines <mail@cbaines.net> # Add a git_repositories table
 git_branches 2019-05-05T14:53:12Z Christopher Baines <mail@cbaines.net> # Add a git_branches table
 remove_package_metadata_sha1_hash 2019-05-12T10:37:40Z Christopher Baines <mail@cbaines.net> # Remove the sha1_hash field from package_metadata
+add_location_information 2019-05-12T20:27:48Z Christopher Baines <mail@cbaines.net> # Add locations table and location to package_metadata
+add_git_repositories_cgit_url_base 2019-05-13T18:45:14Z Christopher Baines <mail@cbaines.net> # Add cgit_url_base to git_repositories
diff --git a/sqitch/verify/add_git_repositories_cgit_url_base.sql b/sqitch/verify/add_git_repositories_cgit_url_base.sql
new file mode 100644
index 0000000..9fa2dee
--- /dev/null
+++ b/sqitch/verify/add_git_repositories_cgit_url_base.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:add_git_repositories_cgit_url_base on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;
diff --git a/sqitch/verify/add_location_information.sql b/sqitch/verify/add_location_information.sql
new file mode 100644
index 0000000..821c643
--- /dev/null
+++ b/sqitch/verify/add_location_information.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:add_location_information on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;
-- 
cgit v1.2.3