mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-07 09:51:37 +00:00
fix migration metadata table detection on postgres
This commit is contained in:
parent
453cd2587b
commit
f31826c256
1 changed files with 15 additions and 1 deletions
|
|
@ -215,7 +215,7 @@ class MigrationManager {
|
||||||
|
|
||||||
async checkOrCreateMigrationsMetaTable() {
|
async checkOrCreateMigrationsMetaTable() {
|
||||||
const queryInterface = this.sequelize.getQueryInterface()
|
const queryInterface = this.sequelize.getQueryInterface()
|
||||||
let migrationsMetaTableExists = await queryInterface.tableExists(MigrationManager.MIGRATIONS_META_TABLE)
|
let migrationsMetaTableExists = await this.tableExists(MigrationManager.MIGRATIONS_META_TABLE)
|
||||||
|
|
||||||
// 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) {
|
||||||
|
|
@ -255,6 +255,20 @@ class MigrationManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async tableExists(tableName) {
|
||||||
|
const queryInterface = this.sequelize.getQueryInterface()
|
||||||
|
if (typeof queryInterface.tableExists === 'function') {
|
||||||
|
return queryInterface.tableExists(tableName)
|
||||||
|
}
|
||||||
|
|
||||||
|
const tables = await queryInterface.showAllTables()
|
||||||
|
return tables.some((table) => {
|
||||||
|
if (typeof table === 'string') return table === tableName
|
||||||
|
if (table?.tableName) return table.tableName === tableName
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
extractVersionFromTag(tag) {
|
extractVersionFromTag(tag) {
|
||||||
if (!tag) return null
|
if (!tag) return null
|
||||||
const versionMatch = tag.match(/^v?(\d+\.\d+\.\d+)/)
|
const versionMatch = tag.match(/^v?(\d+\.\d+\.\d+)/)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue