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

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

    public async up() {
        this.schema.createTable(this.tableName, (table) => {
            table.string('id', 70).primary()
            table.timestamp('updated_at', { useTz: true })
            table.timestamp('created_at', { useTz: true }).defaultTo(this.now())
            table.string('platform').notNullable()
            table.string('device_info').nullable()
            table.string('channel').notNullable()
            table.integer('total').defaultTo(0)
            table.integer('scanned').defaultTo(0)
        })
    }

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