mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-21 23:40:26 +01:00
22 lines
658 B
TypeScript
22 lines
658 B
TypeScript
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('id').inTable('users').onDelete('CASCADE')
|
|
table.string('name').notNullable()
|
|
table.string('type').notNullable()
|
|
table.string('token', 64).notNullable()
|
|
table.timestamp('expires_at', { useTz: true }).nullable()
|
|
table.timestamps()
|
|
})
|
|
}
|
|
|
|
public async down () {
|
|
this.schema.dropTable(this.tableName)
|
|
}
|
|
}
|