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

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

    public async up() {
        this.schema.createTable(this.tableName, (table) => {
            table.increments('id')
            table.dateTime('created_at', { useTz: true })
            table.dateTime('updated_at', { useTz: true })
            table.string('title').notNullable()
            table.string('description')
            table.string('cover')
            table.string('tags')
            table.datetime('release_date', { useTz: true }).nullable()
            table.text('meta')
            table.integer('play_count').defaultTo(0)
            table.decimal('price', 19, 6).defaultTo(0)
            table.integer('total_episodes').defaultTo(0)
        })
    }

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