import { BaseSchema } from '@adonisjs/lucid/schema'

export default class extends BaseSchema {
  protected tableName = 'webhook_statuses'

  async up() {
    this.schema.createTable(this.tableName, (table) => {
      table.increments('id')
      table.string('awb_number').notNullable()
      table.string('tracking_status').notNullable()
      table.string('remarks').notNullable()
      table.tinyint('webhook_event_type').notNullable()
      table.boolean('is_status_updated').defaultTo(false)
      table.timestamp('status_updated_at').nullable()

      table.timestamp('created_at').notNullable()
      table.timestamp('updated_at').nullable()
    })
  }

  async down() {
    this.schema.dropTable(this.tableName)
  }
}
