Merge pull request #928 from gradido/clean_model_migrations

fix migrations to use only the entity model
This commit is contained in:
einhornimmond 2021-10-02 12:55:50 +02:00 committed by GitHub
commit 142aa221a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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