From 081dea194ba8f63878735775416c12faa769b6b3 Mon Sep 17 00:00:00 2001
From: Georgios Andreadis <g.andreadis@student.tudelft.nl>
Date: Tue, 8 Aug 2017 13:06:05 +0300
Subject: Add traceId foreign key to job model

---
 database/schema.sql | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'database/schema.sql')

diff --git a/database/schema.sql b/database/schema.sql
index 858f5d47..6338a457 100644
--- a/database/schema.sql
+++ b/database/schema.sql
@@ -151,8 +151,13 @@ CREATE TABLE IF NOT EXISTS traces (
 
 -- A job
 CREATE TABLE IF NOT EXISTS jobs (
-  id   INTEGER PRIMARY KEY     NOT NULL,
-  name TEXT                    NOT NULL
+  id       INTEGER PRIMARY KEY     NOT NULL,
+  name     TEXT                    NOT NULL,
+  trace_id INTEGER                 NOT NULL,
+
+  FOREIGN KEY (trace_id) REFERENCES traces (id)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE
 );
 
 -- A task that's defined in terms of how many flops (floating point operations) it takes to complete
-- 
cgit v1.2.3

