added foreign keys to relations to guarantee data consistency

This commit is contained in:
azivner
2017-12-19 21:40:48 -05:00
parent bb2f47deb2
commit 72712bc24b
17 changed files with 171 additions and 66 deletions

View File

@@ -70,8 +70,8 @@ CREATE TABLE `recent_notes` (
CREATE TABLE IF NOT EXISTS "notes_tree" (
`note_tree_id` TEXT NOT NULL,
`note_id` TEXT NOT NULL,
`note_pid` TEXT NOT NULL,
`note_pos` INTEGER NOT NULL,
`parent_note_id` TEXT NOT NULL,
`note_position` INTEGER NOT NULL,
`prefix` TEXT,
`is_expanded` BOOLEAN,
`is_deleted` INTEGER NOT NULL DEFAULT 0,
@@ -81,7 +81,7 @@ CREATE TABLE IF NOT EXISTS "notes_tree" (
CREATE INDEX `IDX_notes_tree_note_id` ON `notes_tree` (
`note_id`
);
CREATE INDEX `IDX_notes_tree_note_id_note_pid` ON `notes_tree` (
CREATE INDEX `IDX_notes_tree_note_id_parent_note_id` ON `notes_tree` (
`note_id`,
`note_pid`
`parent_note_id`
);