1-- Defines the schema of one class of data
2CREATE TABLE schemas (
3    id INTEGER PRIMARY KEY AUTOINCREMENT,
4    tbl NOT NULL,
5    ts INT NOT NULL,
6    chksum DEFAULT ''
7);
8
9-- Stores the configured type of a single column in a schema
10CREATE TABLE types (
11    id INTEGER PRIMARY KEY AUTOINCREMENT,
12    class NOT NULL,
13    ismulti BOOLEAN DEFAULT 0,
14    label DEFAULT '',
15    config DEFAULT ''
16);
17
18-- Store what columns of which type are there in a schema
19CREATE TABLE schema_cols (
20    sid INTEGER REFERENCES schemas (id),
21    colref INTEGER NOT NULL,
22    enabled BOOLEAN DEFAULT 1,
23    tid INTEGER REFERENCES types (id),
24    sort INTEGER NOT NULL,
25    PRIMARY KEY ( sid, colref)
26);
27