mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-08 10:21:38 +00:00
disable identifier quoting for postgres compatibility
This commit is contained in:
parent
920a7434f1
commit
c7d14f7d30
2 changed files with 7 additions and 6 deletions
|
|
@ -296,7 +296,8 @@ class Database {
|
||||||
this.sequelize = new Sequelize(process.env.DATABASE_URL, {
|
this.sequelize = new Sequelize(process.env.DATABASE_URL, {
|
||||||
dialect: 'postgres',
|
dialect: 'postgres',
|
||||||
logging: logging,
|
logging: logging,
|
||||||
benchmark: benchmark
|
benchmark: benchmark,
|
||||||
|
quoteIdentifiers: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ class MigrationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchVersionsFromDatabase() {
|
async fetchVersionsFromDatabase() {
|
||||||
const migrationsMetaTable = `"${MigrationManager.MIGRATIONS_META_TABLE}"`
|
const migrationsMetaTable = MigrationManager.MIGRATIONS_META_TABLE
|
||||||
await this.checkOrCreateMigrationsMetaTable()
|
await this.checkOrCreateMigrationsMetaTable()
|
||||||
|
|
||||||
const [versionRow] = await this.sequelize.query(`SELECT value as version FROM ${migrationsMetaTable} WHERE key = 'version'`, {
|
const [versionRow] = await this.sequelize.query(`SELECT value as version FROM ${migrationsMetaTable} WHERE key = 'version'`, {
|
||||||
|
|
@ -219,7 +219,7 @@ class MigrationManager {
|
||||||
|
|
||||||
// If the table exists, check that the `version` and `maxVersion` rows exist
|
// If the table exists, check that the `version` and `maxVersion` rows exist
|
||||||
if (migrationsMetaTableExists) {
|
if (migrationsMetaTableExists) {
|
||||||
const [{ count }] = await this.sequelize.query(`SELECT COUNT(*) as count FROM "${MigrationManager.MIGRATIONS_META_TABLE}" WHERE key IN ('version', 'maxVersion')`, {
|
const [{ count }] = await this.sequelize.query(`SELECT COUNT(*) as count FROM ${MigrationManager.MIGRATIONS_META_TABLE} WHERE key IN ('version', 'maxVersion')`, {
|
||||||
type: Sequelize.QueryTypes.SELECT
|
type: Sequelize.QueryTypes.SELECT
|
||||||
})
|
})
|
||||||
if (count < 2) {
|
if (count < 2) {
|
||||||
|
|
@ -247,7 +247,7 @@ class MigrationManager {
|
||||||
allowNull: false
|
allowNull: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await this.sequelize.query(`INSERT INTO "${MigrationManager.MIGRATIONS_META_TABLE}" (key, value) VALUES ('version', :version), ('maxVersion', '0.0.0')`, {
|
await this.sequelize.query(`INSERT INTO ${MigrationManager.MIGRATIONS_META_TABLE} (key, value) VALUES ('version', :version), ('maxVersion', '0.0.0')`, {
|
||||||
replacements: { version: this.isDatabaseNew ? this.serverVersion : '0.0.0' },
|
replacements: { version: this.isDatabaseNew ? this.serverVersion : '0.0.0' },
|
||||||
type: Sequelize.QueryTypes.INSERT
|
type: Sequelize.QueryTypes.INSERT
|
||||||
})
|
})
|
||||||
|
|
@ -319,7 +319,7 @@ class MigrationManager {
|
||||||
|
|
||||||
async updateMaxVersion() {
|
async updateMaxVersion() {
|
||||||
try {
|
try {
|
||||||
await this.sequelize.query(`UPDATE "${MigrationManager.MIGRATIONS_META_TABLE}" SET value = :maxVersion WHERE key = 'maxVersion'`, {
|
await this.sequelize.query(`UPDATE ${MigrationManager.MIGRATIONS_META_TABLE} SET value = :maxVersion WHERE key = 'maxVersion'`, {
|
||||||
replacements: { maxVersion: this.serverVersion },
|
replacements: { maxVersion: this.serverVersion },
|
||||||
type: Sequelize.QueryTypes.UPDATE
|
type: Sequelize.QueryTypes.UPDATE
|
||||||
})
|
})
|
||||||
|
|
@ -331,7 +331,7 @@ class MigrationManager {
|
||||||
|
|
||||||
async updateDatabaseVersion() {
|
async updateDatabaseVersion() {
|
||||||
try {
|
try {
|
||||||
await this.sequelize.query(`UPDATE "${MigrationManager.MIGRATIONS_META_TABLE}" SET value = :version WHERE key = 'version'`, {
|
await this.sequelize.query(`UPDATE ${MigrationManager.MIGRATIONS_META_TABLE} SET value = :version WHERE key = 'version'`, {
|
||||||
replacements: { version: this.serverVersion },
|
replacements: { version: this.serverVersion },
|
||||||
type: Sequelize.QueryTypes.UPDATE
|
type: Sequelize.QueryTypes.UPDATE
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue