dnote/testutils/fixtures/schema.sql
Sung Won Cho e7940229cf
Use SQLite (#119)
* Make commands use sqlite

* Migrate system

* Fix tests to use sqlite

* Write test for reducer

* Avoid corrupt state in case error occurs in client after server succeeds

* Export test functions
2018-09-24 06:25:53 +10:00

32 lines
741 B
SQL

CREATE TABLE notes
(
id integer PRIMARY KEY AUTOINCREMENT,
uuid text NOT NULL,
book_uuid text NOT NULL,
content text NOT NULL,
added_on integer NOT NULL,
edited_on integer DEFAULT 0,
public bool DEFAULT false
);
CREATE TABLE books
(
uuid text PRIMARY KEY,
label text NOT NULL
);
CREATE TABLE actions
(
uuid text PRIMARY KEY,
schema integer NOT NULL,
type text NOT NULL,
data text NOT NULL,
timestamp integer NOT NULL
);
CREATE TABLE system
(
key string NOT NULL,
value text NOT NULL
);
CREATE UNIQUE INDEX idx_books_label ON books(label);
CREATE INDEX idx_books_uuid ON books(uuid);
CREATE INDEX idx_notes_id ON notes(id);
CREATE INDEX idx_notes_book_uuid ON notes(book_uuid);