This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
wikipedia-game-solver/apps/api/database/migrations/1723204419779_create_access_tokens_table.ts

32 lines
926 B
TypeScript
Raw Permalink Normal View History

2024-08-09 23:51:41 +02:00
import { BaseSchema } from "@adonisjs/lucid/schema"
export default class CreateAccessTokensTable extends BaseSchema {
protected tableName = "auth_access_tokens"
public override async up(): Promise<void> {
2024-08-10 02:32:34 +02:00
void this.schema.createTable(this.tableName, (table) => {
2024-08-09 23:51:41 +02:00
table.increments("id")
table
.integer("tokenable_id")
.notNullable()
.unsigned()
.references("users.id")
2024-08-09 23:51:41 +02:00
.onDelete("CASCADE")
.onUpdate("CASCADE")
2024-08-09 23:51:41 +02:00
table.string("type").notNullable()
table.string("name").nullable()
table.string("hash").notNullable()
table.text("abilities").notNullable()
table.timestamp("created_at")
table.timestamp("updated_at")
table.timestamp("last_used_at").nullable()
table.timestamp("expires_at").nullable()
})
}
public override async down(): Promise<void> {
2024-08-10 02:32:34 +02:00
void this.schema.dropTable(this.tableName)
2024-08-09 23:51:41 +02:00
}
}