From 111d92bd81c23653ad4fa13b868611449aed8329 Mon Sep 17 00:00:00 2001 From: azivner Date: Wed, 20 Dec 2017 22:39:18 -0500 Subject: [PATCH] remove also second foreign key from notes_tree --- migrations/0059__remove_foreign_key_again.sql | 28 +++++++++++++++++++ services/app_info.js | 2 +- services/build.js | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 migrations/0059__remove_foreign_key_again.sql diff --git a/migrations/0059__remove_foreign_key_again.sql b/migrations/0059__remove_foreign_key_again.sql new file mode 100644 index 000000000..22b83eaf7 --- /dev/null +++ b/migrations/0059__remove_foreign_key_again.sql @@ -0,0 +1,28 @@ +CREATE TABLE IF NOT EXISTS "notes_tree_mig" ( + `note_tree_id` TEXT NOT NULL, + `note_id` TEXT 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, + `date_modified` TEXT NOT NULL, + PRIMARY KEY(`note_tree_id`) +); + +INSERT INTO notes_tree_mig (note_tree_id, note_id, parent_note_id, note_position, prefix, is_expanded, is_deleted, date_modified) + SELECT note_tree_id, note_id, parent_note_id, note_position, prefix, is_expanded, is_deleted, date_modified FROM notes_tree; + +DROP TABLE notes_tree; +ALTER TABLE notes_tree_mig RENAME TO notes_tree; + +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` ( + `note_id`, + `parent_note_id` +); +CREATE INDEX `IDX_notes_tree_note_id` ON `notes_tree` ( + `note_id` +); \ No newline at end of file diff --git a/services/app_info.js b/services/app_info.js index 2bc32d857..638dc5ccf 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 = 58; +const APP_DB_VERSION = 59; module.exports = { app_version: packageJson.version, diff --git a/services/build.js b/services/build.js index e8511792e..3995596e1 100644 --- a/services/build.js +++ b/services/build.js @@ -1 +1 @@ -module.exports = { build_date:"2017-12-20T19:52:26-05:00", build_revision: "00e316fe290a491ac00f15bc5de495e66e64bf2d" }; +module.exports = { build_date:"2017-12-20T22:31:56-05:00", build_revision: "66652f2f0c57d5511781901ff6e62dc6d9591c83" };