mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
Updated migration.js
Makes the script more informative by printing columns that are getting skipped because they already exist.
This commit is contained in:
parent
715132a0d6
commit
635027bde4
@ -20,7 +20,9 @@ migration.start = async () => {
|
||||
await Promise.all(tables.map(table => {
|
||||
const columns = Object.keys(map[table])
|
||||
return Promise.all(columns.map(async column => {
|
||||
if (await db.schema.hasColumn(table, column)) { return }
|
||||
if (await db.schema.hasColumn(table, column)) {
|
||||
return console.log(`Column "${column}" already exists in table "${table}".`)
|
||||
}
|
||||
const columnType = map[table][column]
|
||||
return db.schema.table(table, t => { t[columnType](column) })
|
||||
.then(() => console.log(`Added column "${column}" to table "${table}".`))
|
||||
|
Loading…
Reference in New Issue
Block a user