2017-08-20 17:09:25 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const Schema = use('Schema')
|
|
|
|
|
|
|
|
class TokensSchema extends Schema {
|
|
|
|
up () {
|
2018-05-21 21:37:14 +00:00
|
|
|
this.create('tokens', (table) => {
|
2017-08-20 17:09:25 +00:00
|
|
|
table.increments()
|
|
|
|
table.integer('user_id').unsigned().references('id').inTable('users')
|
2018-04-13 07:10:34 +00:00
|
|
|
table.string('token', 255).notNullable().unique().index()
|
2017-10-29 18:24:28 +00:00
|
|
|
table.string('type', 80).notNullable()
|
2017-08-20 17:09:25 +00:00
|
|
|
table.boolean('is_revoked').defaultTo(false)
|
|
|
|
table.timestamps()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
down () {
|
|
|
|
this.drop('tokens')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = TokensSchema
|