Skip to content

Commit

Permalink
Temporariliy disable sqlite3 unicode extension on linux-arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
mikiher committed Aug 5, 2024
1 parent 8ff7b6b commit 87727d5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions server/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -826,15 +836,6 @@ class Database {
}
}

/**
*
* @param {string} value
* @returns {string}
*/
normalize(value) {
return `lower(unaccent(${value}))`
}

/**
*
* @param {string} query
Expand Down

0 comments on commit 87727d5

Please sign in to comment.