Revert unicode sqlite extension to fix db corruption #3241

This commit is contained in:
advplyr 2024-08-09 16:41:52 -05:00
parent c5ba40a178
commit 3a1e9abd68
4 changed files with 9 additions and 9 deletions

View File

@ -207,7 +207,6 @@ class Database {
try {
await this.sequelize.authenticate()
await this.loadExtensions([process.env.SQLEAN_UNICODE_PATH])
Logger.info(`[Database] Db connection was successful`)
return true
} catch (error) {
@ -217,7 +216,7 @@ class Database {
}
/**
*
* TODO: Temporarily disabled
* @param {string[]} extensions paths to extension binaries
*/
async loadExtensions(extensions) {
@ -827,7 +826,7 @@ class Database {
}
/**
*
* TODO: Temporarily unused
* @param {string} value
* @returns {string}
*/
@ -836,7 +835,7 @@ class Database {
}
/**
*
* TODO: Temporarily unused
* @param {string} query
* @returns {Promise<string>}
*/
@ -855,7 +854,7 @@ class Database {
*/
matchExpression(column, normalizedQuery) {
const normalizedPattern = this.sequelize.escape(`%${normalizedQuery}%`)
const normalizedColumn = this.normalize(column)
const normalizedColumn = column
return `${normalizedColumn} LIKE ${normalizedPattern}`
}
}

View File

@ -263,8 +263,9 @@ module.exports.sqlean = sqlean // for testing
class BinaryManager {
defaultRequiredBinaries = [
new Binary('ffmpeg', 'executable', 'FFMPEG_PATH', ['5.1'], ffbinaries), // ffmpeg executable
new Binary('ffprobe', 'executable', 'FFPROBE_PATH', ['5.1'], ffbinaries), // ffprobe executable
new Binary('unicode', 'library', 'SQLEAN_UNICODE_PATH', ['0.24.2'], sqlean) // sqlean unicode extension
new Binary('ffprobe', 'executable', 'FFPROBE_PATH', ['5.1'], ffbinaries) // ffprobe executable
// TODO: Temporarily disabled due to db corruption issues
// new Binary('unicode', 'library', 'SQLEAN_UNICODE_PATH', ['0.24.2'], sqlean) // sqlean unicode extension
]
constructor(requiredBinaries = this.defaultRequiredBinaries) {

View File

@ -975,7 +975,7 @@ module.exports = {
async search(oldUser, oldLibrary, query, limit, offset) {
const userPermissionBookWhere = this.getUserPermissionBookWhereQuery(oldUser)
const normalizedQuery = await Database.getNormalizedQuery(query)
const normalizedQuery = query
const matchTitle = Database.matchExpression('title', normalizedQuery)
const matchSubtitle = Database.matchExpression('subtitle', normalizedQuery)

View File

@ -314,7 +314,7 @@ module.exports = {
async search(oldUser, oldLibrary, query, limit, offset) {
const userPermissionPodcastWhere = this.getUserPermissionPodcastWhereQuery(oldUser)
const normalizedQuery = await Database.getNormalizedQuery(query)
const normalizedQuery = query
const matchTitle = Database.matchExpression('title', normalizedQuery)
const matchAuthor = Database.matchExpression('author', normalizedQuery)