fix migrations to use only the entity model

This commit is contained in:
Ulf Gebhardt 2021-10-01 19:20:02 +02:00
parent 165f86bdb1
commit b043bbe79b
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD

View File

@ -1,11 +1,8 @@
import { getConnection } from 'typeorm'
import { Migration } from './entity/Migration'
const getDBVersion = async (): Promise<string | null> => {
const connection = getConnection()
const migrations = connection.getRepository(Migration)
try {
const dbVersion = await migrations.findOne({ order: { version: 'DESC' } })
const dbVersion = await Migration.findOne({ order: { version: 'DESC' } })
return dbVersion ? dbVersion.fileName : null
} catch (error) {
return null