import BaseSchema from '@ioc:Adonis/Lucid/Schema' export default class extends BaseSchema { protected tableName = 'users' 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.enum('role', ['admin', 'user']).defaultTo('user') table.string('username', 80).notNullable().unique() table.string('phone', 120).nullable().unique() table.string('email', 190).notNullable().unique() table.string('password').nullable() table.string('avatar').nullable() }) } public async down() { this.schema.dropTable(this.tableName) } }