guix-data-service/sqitch/deploy/add_location_information.sql
Christopher Baines 7341d17254 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.
2019-05-13 21:07:48 +01:00

20 lines
651 B
PL/PgSQL

-- 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;