Temporariliy disable sqlite3 unicode extension on linux-arm64

This commit is contained in:
mikiher 2024-08-05 11:44:08 +03:00
parent 8ff7b6b6e6
commit 87727d5f68

View file

@ -17,6 +17,14 @@ class Database {
this.settings = [] 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 // Cached library filter data
this.libraryFilterData = {} this.libraryFilterData = {}
@ -205,9 +213,11 @@ class Database {
// Helper function // Helper function
this.sequelize.uppercaseFirst = (str) => (str ? `${str[0].toUpperCase()}${str.substr(1)}` : '') this.sequelize.uppercaseFirst = (str) => (str ? `${str[0].toUpperCase()}${str.substr(1)}` : '')
const extensions = this.loadUnicodeExtionsion ? [process.env.SQLEAN_UNICODE_PATH] : []
try { try {
await this.sequelize.authenticate() await this.sequelize.authenticate()
await this.loadExtensions([process.env.SQLEAN_UNICODE_PATH]) await this.loadExtensions(extensions)
Logger.info(`[Database] Db connection was successful`) Logger.info(`[Database] Db connection was successful`)
return true return true
} catch (error) { } catch (error) {
@ -826,15 +836,6 @@ class Database {
} }
} }
/**
*
* @param {string} value
* @returns {string}
*/
normalize(value) {
return `lower(unaccent(${value}))`
}
/** /**
* *
* @param {string} query * @param {string} query