blob: 95df32aa2904d0a92091148f1f0813e2224cb196 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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;
|