push
This commit is contained in:
@@ -146,12 +146,19 @@ implements TableDefinitionExporter {
|
||||
|
||||
this.knex = Knex(conf)
|
||||
|
||||
await Promise.all(this.getTableDefinitions().map(async (def)=>{
|
||||
const hasTable = await this.knex.schema.hasTable(def.name)
|
||||
if(!hasTable){
|
||||
await this.knex.schema.createTable(def.name, def.tableBuilder)
|
||||
}
|
||||
}))
|
||||
await Promise.all(
|
||||
this.getTableDefinitions()
|
||||
//make unique by name
|
||||
.filter((other, index, self) => index === self.findIndex(
|
||||
(self) => self.name === other.name)
|
||||
)
|
||||
//create table if not exists
|
||||
.map(async (def)=> {
|
||||
const hasTable = await this.knex.schema.hasTable(def.name)
|
||||
if(!hasTable)
|
||||
return await this.knex.schema.createTable(def.name, def.tableBuilder)
|
||||
})
|
||||
)
|
||||
|
||||
return this.knex
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user