mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
also check if migration table is present at all
This commit is contained in:
parent
ffc83845e5
commit
d4b5872ef2
@ -26,13 +26,16 @@ export default async (): Promise<void> => {
|
|||||||
DEFAULT COLLATE utf8mb4_unicode_ci;`)
|
DEFAULT COLLATE utf8mb4_unicode_ci;`)
|
||||||
|
|
||||||
// Check if old migration table is present, delete if needed
|
// Check if old migration table is present, delete if needed
|
||||||
const [rows] = await con.query(
|
const [rows] = await con.query(`SHOW TABLES FROM \`${CONFIG.DB_DATABASE}\` LIKE 'migrations';`)
|
||||||
`SHOW COLUMNS FROM \`${CONFIG.DB_DATABASE}\`.\`migrations\` LIKE 'db_version';`,
|
|
||||||
)
|
|
||||||
if ((<RowDataPacket>rows).length > 0) {
|
if ((<RowDataPacket>rows).length > 0) {
|
||||||
await con.query(`DROP TABLE \`${CONFIG.DB_DATABASE}\`.\`migrations\``)
|
const [rows] = await con.query(
|
||||||
// eslint-disable-next-line no-console
|
`SHOW COLUMNS FROM \`${CONFIG.DB_DATABASE}\`.\`migrations\` LIKE 'db_version';`,
|
||||||
console.log('Found and dropped old migrations table')
|
)
|
||||||
|
if ((<RowDataPacket>rows).length > 0) {
|
||||||
|
await con.query(`DROP TABLE \`${CONFIG.DB_DATABASE}\`.\`migrations\``)
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log('Found and dropped old migrations table')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await con.end()
|
await con.end()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user