Only enable FTS3 when schema needs upgrading

This commit is contained in:
Jonas Kvinge 2021-04-08 22:12:14 +02:00
parent d7310ba307
commit b7de5d6df3
1 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ QSqlDatabase Database::Connect() {
UpdateDatabaseSchema(0, db);
}
{
if (SchemaVersion(&db) < 10) {
// Register unicode from unicode61 tokenizer to drop old FTS3 tables.
// We need it also to drop old devices later when loading devices.
// And that's done in a different thread after schemas are upgraded, so register it anyway.
@ -160,7 +160,7 @@ QSqlDatabase Database::Connect() {
if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {
sqlite3 *handle = *static_cast<sqlite3**>(v.data());
if (handle) {
int result = sqlite3_db_config(handle, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, NULL);
int result = sqlite3_db_config(handle, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, nullptr);
if (result != SQLITE_OK) qLog(Fatal) << "Unable to enable FTS3 tokenizer";
}
else qLog(Fatal) << "Unable to enable FTS3 tokenizer";