1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Added simple Key-Value store to support temporary data

This commit is contained in:
Laurent Cozic
2019-06-07 08:05:15 +00:00
parent b5b228af15
commit de5fdc84f8
5 changed files with 192 additions and 1 deletions

View File

@@ -292,7 +292,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];
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];
let currentVersionIndex = existingDatabaseVersions.indexOf(fromVersion);
@@ -608,6 +608,21 @@ class JoplinDatabase extends Database {
queries.push('CREATE INDEX resources_to_download_updated_time ON resources_to_download (updated_time)');
}
if (targetVersion == 23) {
const newTableSql = `
CREATE TABLE key_values (
id INTEGER PRIMARY KEY,
\`key\` TEXT NOT NULL,
\`value\` TEXT NOT NULL,
\`type\` INT NOT NULL,
updated_time INT NOT NULL
);
`;
queries.push(this.sqlStringToLines(newTableSql)[0]);
queries.push('CREATE UNIQUE INDEX key_values_key ON key_values (key)');
}
queries.push({ sql: 'UPDATE version SET version = ?', params: [targetVersion] });
try {