Rework migrations schemes

This commit is contained in:
2021-08-16 22:32:08 +02:00
parent e22e0b55c5
commit 09e5b2f76f
11 changed files with 32 additions and 37 deletions

View File

@@ -6,7 +6,11 @@ export default class ApiTokens extends BaseSchema {
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.integer('user_id')
.unsigned()
.references('id')
.inTable('users')
.onDelete('CASCADE')
table.string('name').notNullable()
table.string('type').notNullable()
table.string('token', 64).notNullable()