aboutsummaryrefslogtreecommitdiff
path: root/sqlinit.txt
diff options
context:
space:
mode:
Diffstat (limited to 'sqlinit.txt')
-rw-r--r--sqlinit.txt101
1 files changed, 101 insertions, 0 deletions
diff --git a/sqlinit.txt b/sqlinit.txt
new file mode 100644
index 0000000..b5c5196
--- /dev/null
+++ b/sqlinit.txt
@@ -0,0 +1,101 @@
+CREATE TABLE FileRecords (
+Idx INTEGER,
+Ver INTEGER,
+Ctr INTEGER,
+Cert BLOB,
+HMAC BLOB,
+ACL_logleaves INTEGER
+);
+
+CREATE TABLE FileLeaves (
+FileIdx INTEGER,
+LeafIdx INTEGER,
+Idx INTEGER,
+NextIdx INTEGER,
+Val BLOB,
+PRIMARY KEY (FileIdx, LeafIdx),
+FOREIGN KEY (FileIdx) REFERENCES FileRecords(Idx)
+);
+
+CREATE TABLE FileNodes (
+FileIdx INTEGER,
+NodeIdx INTEGER,
+Val BLOB,
+PRIMARY KEY (FileIdx, NodeIdx),
+FOREIGN KEY (FileIdx) REFERENCES FileRecords(Idx)
+);
+
+CREATE TABLE Versions (
+FileIdx INTEGER,
+Version INTEGER,
+KF BLOB,
+encrypted_secret BLOB,
+Cert BLOB,
+HMAC BLOB,
+Buildcode_logleaves INTEGER,
+Composefile_logleaves INTEGER,
+PRIMARY KEY (FileIdx, Version),
+FOREIGN KEY (FileIdx) REFERENCES FileRecords(Idx)
+);
+
+CREATE TABLE ACLLeaves (
+FileIdx INTEGER,
+LeafIdx INTEGER,
+Idx INTEGER,
+NextIdx INTEGER,
+Val BLOB,
+PRIMARY KEY (FileIdx, LeafIdx),
+FOREIGN KEY (FileIdx) REFERENCES FileRecords(Idx)
+);
+
+CREATE TABLE ACLNodes (
+FileIdx INTEGER,
+NodeIdx INTEGER,
+Val BLOB,
+PRIMARY KEY (FileIdx, NodeIdx),
+FOREIGN KEY (FileIdx) REFERENCES FileRecords(Idx)
+);
+
+CREATE TABLE BCLeaves (
+FileIdx INTEGER,
+Version INTEGER,
+LeafIdx INTEGER,
+Idx INTEGER,
+NextIdx INTEGER,
+Val BLOB,
+PRIMARY KEY (FileIdx, Version, LeafIdx),
+FOREIGN KEY (FileIdx) REFERENCES FileRecords(Idx),
+FOREIGN KEY (Version) REFERENCES Versions(Version)
+);
+
+CREATE TABLE BCNodes (
+FileIdx INTEGER,
+Version INTEGER,
+Val BLOB,
+NodeIdx INTEGER,
+PRIMARY KEY (FileIdx, Version, NodeIdx),
+FOREIGN KEY (FileIdx) REFERENCES FileRecords(Idx),
+FOREIGN KEY (Version) REFERENCES Versions(Version)
+);
+
+CREATE TABLE CFLeaves (
+FileIdx INTEGER,
+Version INTEGER,
+LeafIdx INTEGER,
+Idx INTEGER,
+NextIdx INTEGER,
+Val BLOB,
+PRIMARY KEY (FileIdx, Version, LeafIdx),
+FOREIGN KEY (FileIdx) REFERENCES FileRecords(Idx),
+FOREIGN KEY (Version) REFERENCES Versions(Version)
+);
+
+CREATE TABLE CFNodes (
+FileIdx INTEGER,
+Version INTEGER,
+Val BLOB,
+NodeIdx INTEGER,
+PRIMARY KEY (FileIdx, Version, NodeIdx),
+FOREIGN KEY (FileIdx) REFERENCES FileRecords(Idx),
+FOREIGN KEY (Version) REFERENCES Versions(Version)
+);