import BaseSchema from '@ioc:Adonis/Lucid/Schema'

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

    public async up() {
        this.schema.createTable(this.tableName, (table) => {
            table.increments('id')
            table.string('name').notNullable()
            table.integer('device_num').defaultTo(0).notNullable()
            table.integer('record_num').defaultTo(0).notNullable()
            table.integer('scan_num').defaultTo(0).notNullable()
            table.timestamp('updated_at', { useTz: true })
            table.timestamp('created_at', { useTz: true }).defaultTo(this.now())
        })
    }

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