pub const SQLITE_DDL: &str = "\
CREATE TABLE IF NOT EXISTS beck_log (
seq INTEGER PRIMARY KEY,
at INTEGER NOT NULL,
actor TEXT NOT NULL,
body BLOB NOT NULL
);
CREATE TABLE IF NOT EXISTS beck_snapshot (
seq INTEGER PRIMARY KEY,
state BLOB NOT NULL
);
CREATE TABLE IF NOT EXISTS beck_meta (
id INTEGER PRIMARY KEY CHECK (id = 1),
format INTEGER NOT NULL
);
";Expand description
The same three tables, in SQLite’s dialect.
INTEGER PRIMARY KEY is the one spelling SQLite aliases to its own rowid, which is what makes
it monotonic and gap-free for an append-only table — the property BIGSERIAL gives above. Any
other integer type would be an ordinary column with a btree beside it.
There is no BRIN analogue and none is wanted: the rowid is the physical order, so
WHERE seq > ? ORDER BY seq LIMIT ? is already a range scan of the table itself.