From 53ee1fa5ed6bb384cd8e588f14df3e2d891acaed Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 2 Jan 2018 19:20:42 -0500 Subject: [PATCH] note_id - parent_note_id index needs to be unique --- db/schema.sql | 2 +- migrations/0061__change_index_to_unique.sql | 6 ++++++ services/app_info.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 migrations/0061__change_index_to_unique.sql diff --git a/db/schema.sql b/db/schema.sql index 8a5de85cc..4d6b029dc 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -70,7 +70,7 @@ CREATE INDEX `IDX_notes_is_deleted` ON `notes` ( CREATE INDEX `IDX_notes_tree_note_tree_id` ON `notes_tree` ( `note_tree_id` ); -CREATE INDEX `IDX_notes_tree_note_id_parent_note_id` ON `notes_tree` ( +CREATE UNIQUE INDEX `IDX_notes_tree_note_id_parent_note_id` ON `notes_tree` ( `note_id`, `parent_note_id` ); diff --git a/migrations/0061__change_index_to_unique.sql b/migrations/0061__change_index_to_unique.sql new file mode 100644 index 000000000..005658567 --- /dev/null +++ b/migrations/0061__change_index_to_unique.sql @@ -0,0 +1,6 @@ +DROP INDEX IDX_notes_tree_note_id_parent_note_id; + +CREATE UNIQUE INDEX `IDX_notes_tree_note_id_parent_note_id` ON `notes_tree` ( + `note_id`, + `parent_note_id` +); \ No newline at end of file diff --git a/services/app_info.js b/services/app_info.js index 208834ffa..3fbb1ac14 100644 --- a/services/app_info.js +++ b/services/app_info.js @@ -3,7 +3,7 @@ const build = require('./build'); const packageJson = require('../package'); -const APP_DB_VERSION = 60; +const APP_DB_VERSION = 61; module.exports = { app_version: packageJson.version,