1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00

Finished reverting hierarchical tag feature

This commit is contained in:
Laurent Cozic 2020-07-28 19:09:50 +01:00
parent 64d7603eed
commit 7a1707d864

View File

@ -326,7 +326,7 @@ class JoplinDatabase extends Database {
// must be set in the synchronizer too.
// Note: v16 and v17 don't do anything. They were used to debug an issue.
const existingDatabaseVersions = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];
const existingDatabaseVersions = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32];
let currentVersionIndex = existingDatabaseVersions.indexOf(fromVersion);
@ -735,6 +735,28 @@ class JoplinDatabase extends Database {
);
}
if (targetVersion == 31) {
// This empty version is due to the revert of the hierarchical tag feature
// We need to keep the version for the users who have upgraded using
// the pre-release
queries.push('ALTER TABLE tags ADD COLUMN parent_id TEXT NOT NULL DEFAULT ""');
// Drop the tag note count view, instead compute note count on the fly
// queries.push('DROP VIEW tags_with_note_count');
// queries.push(this.addMigrationFile(31));
}
if (targetVersion == 32) {
// This is the same as version 25 - this is to complete the
// revert of the hierarchical tag feature.
queries.push(`CREATE VIEW IF NOT EXISTS tags_with_note_count AS
SELECT tags.id as id, tags.title as title, tags.created_time as created_time, tags.updated_time as updated_time, COUNT(notes.id) as note_count
FROM tags
LEFT JOIN note_tags nt on nt.tag_id = tags.id
LEFT JOIN notes on notes.id = nt.note_id
WHERE notes.id IS NOT NULL
GROUP BY tags.id`);
}
queries.push({ sql: 'UPDATE version SET version = ?', params: [targetVersion] });
try {