handle postgres alias casing in migration metadata

This commit is contained in:
Kevin Gatera 2026-03-02 17:03:03 -05:00
parent f31826c256
commit 920a7434f1
No known key found for this signature in database
GPG key ID: F0D9F5932458CFB9

View file

@ -202,15 +202,15 @@ class MigrationManager {
const migrationsMetaTable = `"${MigrationManager.MIGRATIONS_META_TABLE}"` const migrationsMetaTable = `"${MigrationManager.MIGRATIONS_META_TABLE}"`
await this.checkOrCreateMigrationsMetaTable() await this.checkOrCreateMigrationsMetaTable()
const [{ version }] = 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'`, {
type: Sequelize.QueryTypes.SELECT type: Sequelize.QueryTypes.SELECT
}) })
this.databaseVersion = version this.databaseVersion = versionRow?.version
const [{ maxVersion }] = await this.sequelize.query(`SELECT value as maxVersion FROM ${migrationsMetaTable} WHERE key = 'maxVersion'`, { const [maxVersionRow] = await this.sequelize.query(`SELECT value as maxVersion FROM ${migrationsMetaTable} WHERE key = 'maxVersion'`, {
type: Sequelize.QueryTypes.SELECT type: Sequelize.QueryTypes.SELECT
}) })
this.maxVersion = maxVersion this.maxVersion = maxVersionRow?.maxVersion || maxVersionRow?.maxversion
} }
async checkOrCreateMigrationsMetaTable() { async checkOrCreateMigrationsMetaTable() {