seepur/database/migrations/1503248427885_user.js

27 lines
659 B
JavaScript
Raw Normal View History

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');
2020-04-12 14:25:42 +00:00
table.string('profile_cover');
2020-02-02 22:42:18 +00:00
table.boolean('is_admin').defaultTo(false).notNullable();
2020-03-17 22:16:34 +00:00
table.datetime('last_logged_in').defaultTo(null).nullable();
2020-02-02 22:42:18 +00:00
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