about summary refs log tree commit diff
path: root/src/libstore/schema.sql
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-02-18T13·16+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-02-18T13·16+0000
commitc1a07f94451cfa93aa9ac986188d0e9a536e4b9f (patch)
tree23938df4388bbc35f3d29b50607d4e3bdf193c96 /src/libstore/schema.sql
parenteaaa13ce475687ac0d0e2d3c22c7de73a9a83a49 (diff)
* Convert the Nix database to SQLite.
Diffstat (limited to 'src/libstore/schema.sql')
-rw-r--r--src/libstore/schema.sql27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libstore/schema.sql b/src/libstore/schema.sql
new file mode 100644
index 000000000000..e24132943092
--- /dev/null
+++ b/src/libstore/schema.sql
@@ -0,0 +1,27 @@
+pragma foreign_keys = on;
+
+create table if not exists ValidPaths (
+    path             text primary key not null,
+    hash             text not null,
+    registrationTime integer not null
+);
+
+create table if not exists Refs (
+    referrer  text not null,
+    reference text not null,
+    primary key (referrer, reference),
+    foreign key (referrer) references ValidPaths(path)
+      on delete cascade
+      deferrable initially deferred,
+    foreign key (reference) references ValidPaths(path)
+      on delete restrict
+      deferrable initially deferred
+);
+
+create table if not exists FailedDerivations (
+    path text primary key not null,
+    time integer not null
+);
+
+create index IndexReferrer on Refs(referrer);
+create index IndexReference on Refs(reference);