blob: 7823283b3272448ac1ec2e6c6b17924b480e9d7a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { BaseSchema } from '@adonisjs/lucid/schema'
export default class JwtTokens extends BaseSchema {
protected tableName = 'jwt_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().unique()
table.timestamp('expires_at', { useTz: true }).nullable()
table.string('refresh_token').notNullable().unique().index()
table.timestamp('refresh_token_expires_at', { useTz: true }).notNullable()
table.timestamp('created_at', { useTz: true }).notNullable()
})
}
public async down() {
this.schema.dropTable(this.tableName)
}
}
|