Store token store from db to redis

This commit is contained in:
2021-09-14 21:14:55 +02:00
parent ee5c6a8de7
commit 4f3ec748be
6 changed files with 136 additions and 31 deletions

View File

@@ -1,25 +0,0 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class ApiTokens extends BaseSchema {
protected tableName = 'api_tokens'
public async up () {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').primary()
table
.integer('user_id')
.unsigned()
.references('users.id')
.onDelete('CASCADE')
table.string('name').notNullable()
table.string('type').notNullable()
table.string('token', 64).notNullable()
table.timestamp('expires_at', { useTz: true }).nullable()
table.timestamp('created_at', { useTz: true }).notNullable()
})
}
public async down () {
this.schema.dropTable(this.tableName)
}
}