| 12345678910111213141516171819202122 |
- 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.timestamp('created_at', { useTz: true })
- table.timestamp('updated_at', { useTz: true })
- table.string('username', 80).notNullable().unique()
- table.string('phone', 120).nullable().unique()
- table.string('email').notNullable()
- table.string('password').nullable()
- table.string('avatar').nullable()
- })
- }
- public async down() {
- this.schema.dropTable(this.tableName)
- }
- }
|