Files
duty-schedule-api/database/migrations/1634474414234_users.ts

24 lines
591 B
TypeScript

import Hash from '@ioc:Adonis/Core/Hash'
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
import User from 'App/Models/User'
export default class Users extends BaseSchema {
protected tableName = 'users'
public async up () {
this.schema.alterTable(this.tableName, (table) => {
table.boolean('is_active').defaultTo(false)
table.string('role')
.defaultTo('employee')
.notNullable()
})
}
public async down () {
this.schema.alterTable(this.tableName, (table) => {
table.dropColumn('is_active')
table.dropColumn('role')
})
}
}