mirror of https://github.com/TriliumNext/Notes
fixed primary keys, added indexes
parent
d1981eb6c3
commit
11bfae4007
@ -0,0 +1,15 @@
|
||||
CREATE TABLE `notes_history_mig` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
|
||||
`note_id` INT,
|
||||
`note_title` TEXT,
|
||||
`note_text` TEXT,
|
||||
`date_modified_from` INT,
|
||||
`date_modified_to` INT,
|
||||
`encryption` INTEGER DEFAULT 0
|
||||
);
|
||||
|
||||
INSERT INTO notes_history (id, note_id, note_title, note_text, date_modified_from, date_modified_to, encryption)
|
||||
SELECT id, note_id, note_title, note_text, date_modified_from, date_modified_to, encryption FROM notes_history;
|
||||
|
||||
DROP TABLE notes_history;
|
||||
ALTER TABLE notes_history_mig RENAME TO notes_history;
|
||||
@ -0,0 +1,41 @@
|
||||
CREATE INDEX `IDX_notes_history_note_id` ON `notes_history` (
|
||||
`note_id`
|
||||
);
|
||||
|
||||
CREATE INDEX `IDX_images_note_id` ON `images` (
|
||||
`note_id`
|
||||
);
|
||||
|
||||
CREATE INDEX `IDX_links_note_id` ON `links` (
|
||||
`note_id`
|
||||
);
|
||||
|
||||
CREATE INDEX `IDX_audit_log_note_id` ON `audit_log` (
|
||||
`note_id`
|
||||
);
|
||||
|
||||
CREATE INDEX `IDX_audit_log_date_modified` ON `audit_log` (
|
||||
`date_modified`
|
||||
);
|
||||
|
||||
CREATE TABLE `notes_mig` (
|
||||
`note_id` TEXT NOT NULL,
|
||||
`note_title` TEXT,
|
||||
`note_text` TEXT,
|
||||
`note_clone_id` TEXT,
|
||||
`date_created` INT,
|
||||
`date_modified` INT,
|
||||
`encryption` INT,
|
||||
`is_deleted` INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`note_id`)
|
||||
);
|
||||
|
||||
INSERT INTO notes_mig (note_id, note_title, note_text, note_clone_id, date_created, date_modified, encryption)
|
||||
SELECT note_id, note_title, note_text, note_clone_id, date_created, date_modified, encryption FROM notes;
|
||||
|
||||
DROP TABLE notes;
|
||||
ALTER TABLE notes_mig RENAME TO notes;
|
||||
|
||||
CREATE INDEX `IDX_notes_is_deleted` ON `notes` (
|
||||
`is_deleted`
|
||||
);
|
||||
Loading…
Reference in New Issue