feat(*) initial commit

This commit is contained in:
Harminder Virk
2017-08-20 22:39:25 +05:30
commit 991657c76b
28 changed files with 1094 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
'use strict'
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

View File

@@ -0,0 +1,21 @@
'use strict'
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', 40).notNullable().unique()
table.boolean('is_revoked').defaultTo(false)
table.timestamps()
})
}
down () {
this.drop('tokens')
}
}
module.exports = TokensSchema