wikipedia-game-solver/apps/api/database/migrations/1723204419777_create_users_table.ts

22 lines
657 B
TypeScript
Raw Normal View History

2024-08-09 23:51:41 +02:00
import { BaseSchema } from "@adonisjs/lucid/schema"
export default class CreateUsersTable extends BaseSchema {
protected tableName = "users"
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").notNullable()
table.string("full_name").notNullable()
2024-08-09 23:51:41 +02:00
table.string("email", 254).notNullable().unique()
table.string("password").notNullable()
table.timestamp("created_at").notNullable()
table.timestamp("updated_at").notNullable()
2024-08-09 23:51:41 +02:00
})
}
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
}
}