aboutsummaryrefslogtreecommitdiff
path: root/sqitch/pg/deploy/initial_derivation_tables.sql
blob: 5d51a9a0e1541015b757d91ec9e95a1cabe224c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- Deploy guix-build-coordinator:initial_derivation_tables to pg

BEGIN;

CREATE TABLE derivations (
       name varchar PRIMARY KEY,
       system varchar NOT NULL
);

CREATE TABLE derivation_outputs (
       id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
       derivation_name varchar NOT NULL REFERENCES derivations (name),
       name varchar NOT NULL,
       output varchar NOT NULL
);

CREATE TABLE derivation_inputs (
       derivation_name varchar REFERENCES derivations (name),
       derivation_output_id integer REFERENCES derivation_outputs (id),
       PRIMARY KEY (derivation_name, derivation_output_id)
);

COMMIT;