2019-07-28 13:09:20 -07:00
|
|
|
const createTableStmt = '''
|
|
|
|
CREATE TABLE IF NOT EXISTS users (
|
|
|
|
id INT NOT NULL PRIMARY KEY DESC ON CONFLICT ROLLBACK AUTOINCREMENT,
|
|
|
|
email VARCHAR NOT NULL UNIQUE ON CONFLICT ABORT,
|
|
|
|
score INT CONSTRAINT "score set" NOT NULL DEFAULT 420 CHECK (score > 0),
|
2020-11-07 03:31:11 -08:00
|
|
|
display_name VARCHAR NULL COLLATE BINARY
|
2020-06-27 05:26:09 -07:00
|
|
|
REFERENCES some(thing) ON UPDATE CASCADE ON DELETE SET NULL
|
|
|
|
DEFERRABLE INITIALLY DEFERRED,
|
2019-07-28 13:09:20 -07:00
|
|
|
|
|
|
|
UNIQUE (score, display_name) ON CONFLICT ABORT,
|
|
|
|
FOREIGN KEY (id, email) REFERENCES another (a, b)
|
|
|
|
ON DELETE NO ACTION ON UPDATE RESTRICT
|
2020-06-27 05:26:09 -07:00
|
|
|
NOT DEFERRABLE INITIALLY IMMEDIATE
|
2019-07-28 13:09:20 -07:00
|
|
|
)
|
|
|
|
''';
|