aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-04-04 12:20:48 +0100
committerChristopher Baines <mail@cbaines.net>2020-04-04 12:20:48 +0100
commitf61c1a11eddb8c14e90c1d3b5bd757712d45c25c (patch)
treef6596dcf128bd711ebb77b864cbdd7c03c51e621
parent4a14e63ebd4f28e7b3be1ef11e4e1e1751d9a443 (diff)
downloadbuild-coordinator-f61c1a11eddb8c14e90c1d3b5bd757712d45c25c.tar
build-coordinator-f61c1a11eddb8c14e90c1d3b5bd757712d45c25c.tar.gz
Add tables for derivations
-rw-r--r--sqitch/pg/deploy/initial_derivation_tables.sql23
-rw-r--r--sqitch/pg/revert/initial_derivation_tables.sql7
-rw-r--r--sqitch/pg/verify/initial_derivation_tables.sql7
-rw-r--r--sqitch/sqitch.plan1
-rw-r--r--sqitch/sqlite/deploy/initial_derivation_tables.sql23
-rw-r--r--sqitch/sqlite/revert/initial_derivation_tables.sql7
-rw-r--r--sqitch/sqlite/verify/initial_derivation_tables.sql7
7 files changed, 75 insertions, 0 deletions
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 <mail@cbaines.net> # Create a schema
+initial_derivation_tables 2020-04-04T09:48:34Z Christopher Baines <mail@cbaines.net> # 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;