module.exports = (knex) => {
  knex.schema.createTableIfNotExists('member', function (table) {
    table.increments('_id').primary()
    table.string('memberName')
    table.string('password')
    table.string('avatar')
    table.string('phoneNumber')
    table.timestamp('createdAt').defaultTo(knex.fn.now())
    table.timestamp('updatedAt').defaultTo(knex.fn.now())
  }).asCallback()
  knex.schema.createTableIfNotExists('user', function (table) {
    table.increments('_id').primary()
    table.string('userName')
    table.string('password')
    table.string('avatar')
    table.string('role').defaultTo('admin')
    table.timestamp('createdAt').defaultTo(knex.fn.now())
    table.timestamp('updatedAt').defaultTo(knex.fn.now())
  }).asCallback()
  {{#each this}}
  knex.schema.createTableIfNotExists('{{this.tableName}}', function (table) {
    table.increments('_id').primary()
    {{#each this.model}}
    table.string('{{this.name}}')
    {{/each}}
    table.timestamp('createdAt').defaultTo(knex.fn.now())
    table.timestamp('updatedAt').defaultTo(knex.fn.now())
  }).asCallback()
  {{/each}}
}
