mirror of
https://github.com/IT4Change/gradido.git
synced 2026-01-20 20:01:31 +00:00
if the old migration table is present selecting fileName will result in an SQL error
This commit is contained in:
parent
6f18f5a7e0
commit
996202a6bd
@ -22,9 +22,10 @@ const DB_VERSION = '0001-init_db'
|
||||
async function main() {
|
||||
// check for correct database version
|
||||
const con = await connection()
|
||||
const [rows] = await con.query(`SELECT fileName FROM migrations ORDER BY version DESC LIMIT 1;`)
|
||||
const [rows] = await con.query(`SELECT * FROM migrations ORDER BY version DESC LIMIT 1;`)
|
||||
if (
|
||||
(<RowDataPacket>rows).length === 0 ||
|
||||
!(<RowDataPacket>rows)[0].fileName ||
|
||||
(<RowDataPacket>rows)[0].fileName.indexOf(DB_VERSION) === -1
|
||||
) {
|
||||
throw new Error(`Wrong database version - the backend requires '${DB_VERSION}'`)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user