31 lines
780 B
TypeScript
31 lines
780 B
TypeScript
import { BaseSchema } from '@adonisjs/lucid/schema'
|
|
|
|
export default class extends BaseSchema {
|
|
protected tableName = 'users'
|
|
|
|
async up() {
|
|
this.schema.createTable(this.tableName, (table) => {
|
|
table.increments('id').notNullable()
|
|
table.string('username', 64).notNullable().unique()
|
|
table.string('password').notNullable()
|
|
|
|
/**
|
|
* TOTP secret, encrypted with the APP_KEY.
|
|
*/
|
|
table.text('totp_secret').notNullable()
|
|
|
|
/**
|
|
* Last accepted TOTP time step, to refuse a code being replayed.
|
|
*/
|
|
table.integer('totp_last_step').nullable()
|
|
|
|
table.timestamp('created_at').notNullable()
|
|
table.timestamp('updated_at').nullable()
|
|
})
|
|
}
|
|
|
|
async down() {
|
|
this.schema.dropTable(this.tableName)
|
|
}
|
|
}
|