summaryrefslogtreecommitdiff
path: root/src/schema.sql
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-11-13 01:54:41 +0100
committerMathieu Lirzin <mthl@gnu.org>2016-11-17 01:19:05 +0100
commitbfd395c09fc2eae6b777ef775584337f26861877 (patch)
treefe8767f333603bd4fc1b656e596673ab52dd39dd /src/schema.sql
parenta948f556eb5e58f31aafa81e7e2125a6a1f91d7b (diff)
downloadcuirass-bfd395c09fc2eae6b777ef775584337f26861877.tar
cuirass-bfd395c09fc2eae6b777ef775584337f26861877.tar.gz
db: Forbid inserting the same specification twice.
* src/schema.sql (Specifications): Make 'repo_name' the primary key. (Stamps, Evaluations): Adapt. * src/cuirass/database.scm (db-get-specifications): Likewise. (db-add-specification): Ignore if SPEC has already been added. * tests/database.scm (example-spec): Adapt.
Diffstat (limited to 'src/schema.sql')
-rw-r--r--src/schema.sql11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/schema.sql b/src/schema.sql
index f8042d1..4aeebb7 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -1,8 +1,7 @@
BEGIN TRANSACTION;
CREATE TABLE Specifications (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- repo_name TEXT NOT NULL,
+ repo_name TEXT NOT NULL PRIMARY KEY,
url TEXT NOT NULL,
load_path TEXT NOT NULL,
file TEXT NOT NULL,
@@ -16,16 +15,16 @@ CREATE TABLE Specifications (
);
CREATE TABLE Stamps (
- specification INTEGER NOT NULL PRIMARY KEY,
+ specification TEXT NOT NULL PRIMARY KEY,
stamp TEXT NOT NULL,
- FOREIGN KEY (specification) REFERENCES Specifications (id)
+ FOREIGN KEY (specification) REFERENCES Specifications (repo_name)
);
CREATE TABLE Evaluations (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- specification INTEGER NOT NULL,
+ specification TEXT NOT NULL,
revision TEXT NOT NULL,
- FOREIGN KEY (specification) REFERENCES Specifications (id)
+ FOREIGN KEY (specification) REFERENCES Specifications (repo_name)
);
CREATE TABLE Derivations (