1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
BEGIN EXCLUSIVE;
CREATE TABLE branch_epochs
(
hash not null unique, -- hash of remaining fields separated by ":"
branch not null unique, -- joins with revision_certs.value
epoch not null -- random hex-encoded id
);
CREATE TABLE db_vars
(
domain not null, -- scope of application of a var
name not null, -- var key
value not null, -- var value
unique(domain, name)
);
CREATE TABLE file_deltas
(
id not null, -- strong hash of file contents
base not null, -- joins with files.id or file_deltas.id
delta not null, -- rdiff to construct current from base
unique(id, base)
);
CREATE TABLE files
(
id primary key, -- strong hash of file contents
data not null -- compressed, encoded contents of a file
);
INSERT INTO files VALUES('1929e9f45b6777c31d067a9f3134a53db506e47c','H4sIAAAAAAAA/ytPzSxKyecCAJMv4PQHAAAA
');
CREATE TABLE manifest_certs
(
hash not null unique, -- hash of remaining fields separated by ":"
id not null, -- joins with manifests.id or manifest_deltas.id
name not null, -- opaque string chosen by user
value not null, -- opaque blob
keypair not null, -- joins with public_keys.id
signature not null, -- RSA/SHA1 signature of "[name@id:val]"
unique(name, id, value, keypair, signature)
);
CREATE TABLE manifest_deltas
(
id not null, -- strong hash of all the entries in a manifest
base not null, -- joins with either manifest.id or manifest_deltas.id
delta not null, -- rdiff to construct current from base
unique(id, base)
);
CREATE TABLE manifests
(
id primary key, -- strong hash of all the entries in a manifest
data not null -- compressed, encoded contents of a manifest
);
INSERT INTO manifests VALUES('078ee6a226774641ad23ff4d72f7acdc5ccfd226','H4sIAAAAAAAA/zO0NLJMtUwzMU0yMzc3TzY2TDEwM0+0TDM2NDZJNDVOSTI1MEs1MU9WUEjK
SczgAgC4r3wQLwAAAA==
');
CREATE TABLE next_roster_node_number
(
node primary key -- only one entry in this table, ever
);
CREATE TABLE public_keys
(
hash not null unique, -- hash of remaining fields separated by ":"
id primary key, -- key identifier chosen by user
keydata not null -- RSA public params
);
INSERT INTO public_keys VALUES('de84b575d5e47254393eba49dce9dc4db98ed42d','njs@pobox.com','MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQC54vVjrrqYoTfPTgWm6JpuL+kOERcN2OSc
BsWq6cb4Wm3nlymwVqJJywq6cbfygUYwmqyiRLPxRosfLGu228AhEzaM4JbAH1pgg7CwvvVd
fHRXNAXEMgO89gBjkkecxLi4U/T67DrLjkRPAilCgWLZNv8YeOG9XAPegWyr7hNA9wIBEQ==');
CREATE TABLE revision_ancestry
(
parent not null, -- joins with revisions.id
child not null, -- joins with revisions.id
unique(parent, child)
);
CREATE TABLE revision_certs
(
hash not null unique, -- hash of remaining fields separated by ":"
id not null, -- joins with revisions.id
name not null, -- opaque string chosen by user
value not null, -- opaque blob
keypair not null, -- joins with public_keys.id
signature not null, -- RSA/SHA1 signature of "[name@id:val]"
unique(name, id, value, keypair, signature)
);
CREATE TABLE revision_roster
(
rev_id primary key, -- joins with revisions.id
roster_id not null -- joins with either rosters.id or roster_deltas.id
);
CREATE TABLE revisions
(
id primary key, -- SHA1(text of revision)
data not null -- compressed, encoded contents of a revision
);
CREATE TABLE roster_deltas
(
id not null, -- strong hash of the roster
base not null, -- joins with either rosters.id or roster_deltas.id
delta not null, -- rdiff to construct current from base
unique(id, base)
);
CREATE TABLE rosters
(
id primary key, -- strong hash of the roster
data not null -- compressed, encoded contents of the roster
);
CREATE INDEX revision_ancestry__child ON revision_ancestry (child);
CREATE INDEX revision_certs__id ON revision_certs (id);
CREATE INDEX revision_certs__name_value ON revision_certs (name, value);
COMMIT;
|