2020-01-14 01:57:43 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
/** @type {import('@adonisjs/lucid/src/Schema')} */
|
|
|
|
const Schema = use('Schema')
|
|
|
|
|
|
|
|
class UserSchema extends Schema {
|
2020-02-02 22:42:18 +00:00
|
|
|
up() {
|
2020-01-14 01:57:43 +00:00
|
|
|
this.create('users', (table) => {
|
2020-02-02 22:42:18 +00:00
|
|
|
table.increments();
|
|
|
|
table.string('email', 254).notNullable().unique();
|
|
|
|
table.string('name').notNullable();
|
|
|
|
table.string('password', 60).notNullable();
|
|
|
|
table.string('avatar');
|
|
|
|
table.boolean('is_admin').defaultTo(false).notNullable();
|
|
|
|
table.timestamps();
|
|
|
|
});
|
2020-01-14 01:57:43 +00:00
|
|
|
}
|
|
|
|
|
2020-02-02 22:42:18 +00:00
|
|
|
down() {
|
|
|
|
this.drop('users');
|
2020-01-14 01:57:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = UserSchema
|