mirror of
https://github.com/dnote/dnote
synced 2026-03-14 22:45:50 +01:00
* Make easier to copy paste to execute * Make migration work * Bump edit_note action schema to v3 * Use UnixNano for timstamps * Fix schema
33 lines
806 B
SQL
33 lines
806 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 UNIQUE INDEX idx_notes_uuid ON notes(uuid);
|
|
CREATE UNIQUE INDEX idx_books_uuid ON books(uuid);
|
|
CREATE UNIQUE INDEX idx_notes_id ON notes(id);
|
|
CREATE INDEX idx_notes_book_uuid ON notes(book_uuid);
|