From f61c1a11eddb8c14e90c1d3b5bd757712d45c25c Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 4 Apr 2020 12:20:48 +0100 Subject: Add tables for derivations --- sqitch/pg/deploy/initial_derivation_tables.sql | 23 ++++++++++++++++++++++ sqitch/pg/revert/initial_derivation_tables.sql | 7 +++++++ sqitch/pg/verify/initial_derivation_tables.sql | 7 +++++++ sqitch/sqitch.plan | 1 + sqitch/sqlite/deploy/initial_derivation_tables.sql | 23 ++++++++++++++++++++++ sqitch/sqlite/revert/initial_derivation_tables.sql | 7 +++++++ sqitch/sqlite/verify/initial_derivation_tables.sql | 7 +++++++ 7 files changed, 75 insertions(+) create mode 100644 sqitch/pg/deploy/initial_derivation_tables.sql create mode 100644 sqitch/pg/revert/initial_derivation_tables.sql create mode 100644 sqitch/pg/verify/initial_derivation_tables.sql create mode 100644 sqitch/sqlite/deploy/initial_derivation_tables.sql create mode 100644 sqitch/sqlite/revert/initial_derivation_tables.sql create mode 100644 sqitch/sqlite/verify/initial_derivation_tables.sql diff --git a/sqitch/pg/deploy/initial_derivation_tables.sql b/sqitch/pg/deploy/initial_derivation_tables.sql new file mode 100644 index 0000000..5d51a9a --- /dev/null +++ b/sqitch/pg/deploy/initial_derivation_tables.sql @@ -0,0 +1,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; diff --git a/sqitch/pg/revert/initial_derivation_tables.sql b/sqitch/pg/revert/initial_derivation_tables.sql new file mode 100644 index 0000000..0c302be --- /dev/null +++ b/sqitch/pg/revert/initial_derivation_tables.sql @@ -0,0 +1,7 @@ +-- Revert guix-build-coordinator:initial_derivation_tables from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/pg/verify/initial_derivation_tables.sql b/sqitch/pg/verify/initial_derivation_tables.sql new file mode 100644 index 0000000..edefa0f --- /dev/null +++ b/sqitch/pg/verify/initial_derivation_tables.sql @@ -0,0 +1,7 @@ +-- Verify guix-build-coordinator:initial_derivation_tables on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index 5426bbd..3e4dc78 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -2,3 +2,4 @@ %project=guix-build-coordinator schema 2020-04-03T21:01:15Z Christopher Baines # Create a schema +initial_derivation_tables 2020-04-04T09:48:34Z Christopher Baines # Create initial derivation related tables diff --git a/sqitch/sqlite/deploy/initial_derivation_tables.sql b/sqitch/sqlite/deploy/initial_derivation_tables.sql new file mode 100644 index 0000000..1e63344 --- /dev/null +++ b/sqitch/sqlite/deploy/initial_derivation_tables.sql @@ -0,0 +1,23 @@ +-- Deploy guix-build-coordinator:initial_derivation_tables to sqlite + +BEGIN; + +CREATE TABLE derivations ( + name TEXT PRIMARY KEY, + system TEXT NOT NULL +); + +CREATE TABLE derivation_outputs ( + id INTEGER PRIMARY KEY ASC, + derivation_name TEXT NOT NULL REFERENCES derivations (name), + name TEXT NOT NULL, + output TEXT NOT NULL +); + +CREATE TABLE derivation_inputs ( + derivation_name TEXT REFERENCES derivations (name), + derivation_output_id INTEGER REFERENCES derivation_outputs (id), + PRIMARY KEY (derivation_name, derivation_output_id) +); + +COMMIT; diff --git a/sqitch/sqlite/revert/initial_derivation_tables.sql b/sqitch/sqlite/revert/initial_derivation_tables.sql new file mode 100644 index 0000000..e693ffe --- /dev/null +++ b/sqitch/sqlite/revert/initial_derivation_tables.sql @@ -0,0 +1,7 @@ +-- Revert guix-build-coordinator:initial_derivation_tables from sqlite + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqlite/verify/initial_derivation_tables.sql b/sqitch/sqlite/verify/initial_derivation_tables.sql new file mode 100644 index 0000000..2838683 --- /dev/null +++ b/sqitch/sqlite/verify/initial_derivation_tables.sql @@ -0,0 +1,7 @@ +-- Verify guix-build-coordinator:initial_derivation_tables on sqlite + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- cgit v1.2.3