aboutsummaryrefslogtreecommitdiff
path: root/sqlinit.txt
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-06-27 17:30:15 -0400
committerFranklin Wei <me@fwei.tk>2018-06-27 17:30:15 -0400
commit7c71372ec3a6a5b67e59feceeb9df23150ba77e9 (patch)
treeaf333f7d3b33601df6b6f336c604df99436f1e1e /sqlinit.txt
parent1e3acc575e82210955774897eecbe0c5567b10ca (diff)
downloadcsaa-7c71372ec3a6a5b67e59feceeb9df23150ba77e9.zip
csaa-7c71372ec3a6a5b67e59feceeb9df23150ba77e9.tar.gz
csaa-7c71372ec3a6a5b67e59feceeb9df23150ba77e9.tar.bz2
csaa-7c71372ec3a6a5b67e59feceeb9df23150ba77e9.tar.xz
WIP on database backend
Diffstat (limited to '')
-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)
+);