aboutsummaryrefslogtreecommitdiff
path: root/sqitch/sqlite
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-04-10 20:30:40 +0100
committerChristopher Baines <mail@cbaines.net>2020-04-10 20:34:47 +0100
commit9dd26c6ee5b29cd61f02c535eccbd2d73cae51ca (patch)
treeb9031cd6587ab4f490bc03e83972195c95e582ff /sqitch/sqlite
parent97876168197cbbc4780fe34582be47f153af79b4 (diff)
downloadbuild-coordinator-9dd26c6ee5b29cd61f02c535eccbd2d73cae51ca.tar
build-coordinator-9dd26c6ee5b29cd61f02c535eccbd2d73cae51ca.tar.gz
Create tables for allocating builds
One table to store which build is allocated to which agent, and another to store a "plan" of allocations. For this plan, a build can be potentially allocated to multiple agents, and which agent it will be allocated to depends on which agent claims it first.
Diffstat (limited to 'sqitch/sqlite')
-rw-r--r--sqitch/sqlite/deploy/build_allocation_tables.sql17
-rw-r--r--sqitch/sqlite/revert/build_allocation_tables.sql7
-rw-r--r--sqitch/sqlite/verify/build_allocation_tables.sql7
3 files changed, 31 insertions, 0 deletions
diff --git a/sqitch/sqlite/deploy/build_allocation_tables.sql b/sqitch/sqlite/deploy/build_allocation_tables.sql
new file mode 100644
index 0000000..c87438c
--- /dev/null
+++ b/sqitch/sqlite/deploy/build_allocation_tables.sql
@@ -0,0 +1,17 @@
+-- Deploy guix-build-coordinator:build_allocation_tables to sqlite
+
+BEGIN;
+
+CREATE TABLE allocated_builds (
+ build_id PRIMARY KEY NOT NULL REFERENCES builds (uuid),
+ agent_id NOT NULL REFERENCES agents (id)
+);
+
+CREATE TABLE build_allocation_plan (
+ build_id NOT NULL REFERENCES builds (uuid),
+ agent_id NOT NULL REFERENCES agents (id),
+ ordering INTEGER NOT NULL,
+ PRIMARY KEY (agent_id, build_id)
+);
+
+COMMIT;
diff --git a/sqitch/sqlite/revert/build_allocation_tables.sql b/sqitch/sqlite/revert/build_allocation_tables.sql
new file mode 100644
index 0000000..193cc59
--- /dev/null
+++ b/sqitch/sqlite/revert/build_allocation_tables.sql
@@ -0,0 +1,7 @@
+-- Revert guix-build-coordinator:build_allocation_tables from sqlite
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/sqlite/verify/build_allocation_tables.sql b/sqitch/sqlite/verify/build_allocation_tables.sql
new file mode 100644
index 0000000..91776a5
--- /dev/null
+++ b/sqitch/sqlite/verify/build_allocation_tables.sql
@@ -0,0 +1,7 @@
+-- Verify guix-build-coordinator:build_allocation_tables on sqlite
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;