added nonce creattion

This commit is contained in:
Sockenklaus
2021-10-23 09:35:53 +02:00
parent f8bf1a745f
commit 42efa25185
6 changed files with 122 additions and 14 deletions

View File

@@ -0,0 +1,22 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Nonces extends BaseSchema {
protected tableName = 'nonces'
public async up () {
this.schema.createTable(this.tableName, (table) => {
/**
* Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
*/
table.timestamp('created_at', { useTz: true })
table.timestamp('updated_at', { useTz: true })
table.timestamp('expiry_date', { useTz: true}).notNullable()
table.string('request_id').unique().notNullable()
table.string('nonce').unique().notNullable()
})
}
public async down () {
this.schema.dropTable(this.tableName)
}
}