generated from shillerben/adonis-fullstack-app
Initial commit
This commit is contained in:
22
database/migrations/1503248427885_user.js
Normal file
22
database/migrations/1503248427885_user.js
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
/** @type {import('@adonisjs/lucid/src/Schema')} */
|
||||
const Schema = use('Schema')
|
||||
|
||||
class UserSchema extends Schema {
|
||||
up () {
|
||||
this.create('users', (table) => {
|
||||
table.increments()
|
||||
table.string('username', 80).notNullable().unique()
|
||||
table.string('email', 254).notNullable().unique()
|
||||
table.string('password', 60).notNullable()
|
||||
table.timestamps()
|
||||
})
|
||||
}
|
||||
|
||||
down () {
|
||||
this.drop('users')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UserSchema
|
||||
23
database/migrations/1503248427886_token.js
Normal file
23
database/migrations/1503248427886_token.js
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict'
|
||||
|
||||
/** @type {import('@adonisjs/lucid/src/Schema')} */
|
||||
const Schema = use('Schema')
|
||||
|
||||
class TokensSchema extends Schema {
|
||||
up () {
|
||||
this.create('tokens', (table) => {
|
||||
table.increments()
|
||||
table.integer('user_id').unsigned().references('id').inTable('users')
|
||||
table.string('token', 255).notNullable().unique().index()
|
||||
table.string('type', 80).notNullable()
|
||||
table.boolean('is_revoked').defaultTo(false)
|
||||
table.timestamps()
|
||||
})
|
||||
}
|
||||
|
||||
down () {
|
||||
this.drop('tokens')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TokensSchema
|
||||
Reference in New Issue
Block a user