18 lines
532 B
TypeScript
18 lines
532 B
TypeScript
import { BaseSchema } from "@adonisjs/lucid/schema"
|
|
|
|
export default class CreateRateLimitsTable extends BaseSchema {
|
|
protected tableName = "rate_limits"
|
|
|
|
public override async up(): Promise<void> {
|
|
void this.schema.createTable(this.tableName, (table) => {
|
|
table.string("key", 255).notNullable().primary()
|
|
table.integer("points", 9).notNullable().defaultTo(0)
|
|
table.bigint("expire").unsigned()
|
|
})
|
|
}
|
|
|
|
public override async down(): Promise<void> {
|
|
void this.schema.dropTable(this.tableName)
|
|
}
|
|
}
|