diff options
Diffstat (limited to 'database/migrations/1503250034280_token.js')
-rw-r--r-- | database/migrations/1503250034280_token.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/database/migrations/1503250034280_token.js b/database/migrations/1503250034280_token.js new file mode 100644 index 0000000..c8bb9fc --- /dev/null +++ b/database/migrations/1503250034280_token.js | |||
@@ -0,0 +1,23 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | /** @type {import('@adonisjs/lucid/src/Schema')} */ | ||
4 | const Schema = use('Schema') | ||
5 | |||
6 | class TokensSchema extends Schema { | ||
7 | up () { | ||
8 | this.create('tokens', (table) => { | ||
9 | table.increments() | ||
10 | table.integer('user_id').unsigned().references('id').inTable('users') | ||
11 | table.string('token', 255).notNullable().unique().index() | ||
12 | table.string('type', 80).notNullable() | ||
13 | table.boolean('is_revoked').defaultTo(false) | ||
14 | table.timestamps() | ||
15 | }) | ||
16 | } | ||
17 | |||
18 | down () { | ||
19 | this.drop('tokens') | ||
20 | } | ||
21 | } | ||
22 | |||
23 | module.exports = TokensSchema | ||