From 87727d5f68adfc9a52c8039c097ba77c714d0f9b Mon Sep 17 00:00:00 2001 From: mikiher Date: Mon, 5 Aug 2024 11:44:08 +0300 Subject: [PATCH] Temporariliy disable sqlite3 unicode extension on linux-arm64 --- server/Database.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/server/Database.js b/server/Database.js index 6fe058c6d..dfb95c838 100644 --- a/server/Database.js +++ b/server/Database.js @@ -17,6 +17,14 @@ class Database { this.settings = [] + this.loadUnicodeExtionsion = process.platform === 'linux' && process.arch === 'arm64' ? false : true + + if (this.loadUnicodeExtionsion) { + this.normalize = (value) => `lower(unaccent(${value}))` + } else { + this.normalize = (value) => value + } + // Cached library filter data this.libraryFilterData = {} @@ -205,9 +213,11 @@ class Database { // Helper function this.sequelize.uppercaseFirst = (str) => (str ? `${str[0].toUpperCase()}${str.substr(1)}` : '') + const extensions = this.loadUnicodeExtionsion ? [process.env.SQLEAN_UNICODE_PATH] : [] + try { await this.sequelize.authenticate() - await this.loadExtensions([process.env.SQLEAN_UNICODE_PATH]) + await this.loadExtensions(extensions) Logger.info(`[Database] Db connection was successful`) return true } catch (error) { @@ -826,15 +836,6 @@ class Database { } } - /** - * - * @param {string} value - * @returns {string} - */ - normalize(value) { - return `lower(unaccent(${value}))` - } - /** * * @param {string} query