Constant tor_dirmgr::storage::sqlite::INSTALL_V0_SCHEMA
source ยท const INSTALL_V0_SCHEMA: &str = "
-- Helps us version the schema. The schema here corresponds to a
-- version number called 'version', and it should be readable by
-- anybody who is compliant with versions of at least 'readable_by'.
CREATE TABLE TorSchemaMeta (
name TEXT NOT NULL PRIMARY KEY,
version INTEGER NOT NULL,
readable_by INTEGER NOT NULL
);
INSERT INTO TorSchemaMeta (name, version, readable_by) VALUES ( 'TorDirStorage', 0, 0 );
-- Keeps track of external blobs on disk.
CREATE TABLE ExtDocs (
-- Records a digest of the file contents, in the form 'dtype-hexstr'
digest TEXT PRIMARY KEY NOT NULL,
-- When was this file created?
created DATE NOT NULL,
-- After what time will this file definitely be useless?
expires DATE NOT NULL,
-- What is the type of this file? Currently supported are 'con:<flavor>'.
type TEXT NOT NULL,
-- Filename for this file within our blob directory.
filename TEXT NOT NULL
);
-- All the microdescriptors we know about.
CREATE TABLE Microdescs (
sha256_digest TEXT PRIMARY KEY NOT NULL,
last_listed DATE NOT NULL,
contents BLOB NOT NULL
);
-- All the authority certificates we know.
CREATE TABLE Authcerts (
id_digest TEXT NOT NULL,
sk_digest TEXT NOT NULL,
published DATE NOT NULL,
expires DATE NOT NULL,
contents BLOB NOT NULL,
PRIMARY KEY (id_digest, sk_digest)
);
-- All the consensuses we're storing.
CREATE TABLE Consensuses (
valid_after DATE NOT NULL,
fresh_until DATE NOT NULL,
valid_until DATE NOT NULL,
flavor TEXT NOT NULL,
pending BOOLEAN NOT NULL,
sha3_of_signed_part TEXT NOT NULL,
digest TEXT NOT NULL,
FOREIGN KEY (digest) REFERENCES ExtDocs (digest) ON DELETE CASCADE
);
CREATE INDEX Consensuses_vu on CONSENSUSES(valid_until);
";
Expand description
Set up the tables for the arti cache schema in a sqlite database.