From d8f5e2a7270a6aed04dac17048c6ef7229d3caab Mon Sep 17 00:00:00 2001
From: Fabian Mastenbroek <mail.fabianm@gmail.com>
Date: Sun, 11 Mar 2018 20:35:28 +0100
Subject: feat: Add stage measurements to schema

---
 database/schema.sql | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'database/schema.sql')

diff --git a/database/schema.sql b/database/schema.sql
index aa0ad1e5..9e356b4a 100644
--- a/database/schema.sql
+++ b/database/schema.sql
@@ -232,6 +232,20 @@ CREATE TABLE task_states (
     ON UPDATE CASCADE
 );
 
+-- The measurements of a single stage
+CREATE TABLE stage_measurements (
+  id            INTEGER PRIMARY KEY     NOT NULL AUTO_INCREMENT,
+  experiment_id INTEGER                 NOT NULL,
+  tick          INTEGER                 NOT NULL CHECK (tick >= 0),
+  stage         INTEGER                 NOT NULL CHECK (stage >= 0),
+  duration      INTEGER                 NOT NULL CHECK (duration >= 0),
+  size          INTEGER                 NOT NULL CHECK (size >= 0),
+
+  FOREIGN KEY (experiment_id) REFERENCES experiments (id)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE
+);
+
 -- A machine state
 DROP TABLE IF EXISTS machine_states;
 CREATE TABLE machine_states (
-- 
cgit v1.2.3

