mirror of https://github.com/AMT-Cheif/drift.git
43 lines
908 B
SQL
43 lines
908 B
SQL
CREATE TABLE no_ids (
|
|
payload BLOB NOT NULL
|
|
) WITHOUT ROWID;
|
|
|
|
CREATE TABLE with_defaults (
|
|
a TEXT DEFAULT 'something',
|
|
b INT UNIQUE
|
|
);
|
|
|
|
CREATE TABLE with_constraints (
|
|
a TEXT,
|
|
b INT NOT NULL,
|
|
c FLOAT(10, 2),
|
|
|
|
FOREIGN KEY (a, b) REFERENCES with_defaults (a, b)
|
|
);
|
|
|
|
create table config (
|
|
config_key TEXT not null primary key,
|
|
config_value TEXT
|
|
) AS "Config";
|
|
|
|
CREATE TABLE mytable (
|
|
someid INTEGER NOT NULL PRIMARY KEY,
|
|
sometext TEXT,
|
|
somebool BOOLEAN,
|
|
somedate DATETIME
|
|
);
|
|
|
|
readConfig: SELECT * FROM config WHERE config_key = ?;
|
|
readMultiple: SELECT * FROM config WHERE config_key IN ? ORDER BY $clause;
|
|
readDynamic: SELECT * FROM config WHERE $predicate;
|
|
|
|
readRowId: SELECT oid, * FROM config WHERE _rowid_ = $expr;
|
|
|
|
cfeTest: WITH RECURSIVE
|
|
cnt(x) AS (
|
|
SELECT 1
|
|
UNION ALL
|
|
SELECT x+1 FROM cnt
|
|
LIMIT 1000000
|
|
)
|
|
SELECT x FROM cnt; |