- added migration files for creating db table for 'backupcodes'
This commit is contained in:
parent
49ea0fc967
commit
f4854d70b9
3 changed files with 430 additions and 468 deletions
|
@ -1,3 +1,28 @@
|
|||
// node ace make:migration backupcodes
|
||||
import { BaseSchema } from '@adonisjs/lucid/schema';
|
||||
|
||||
export default class extends BaseSchema {
|
||||
protected tableName = 'backupcodes';
|
||||
|
||||
async up() {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id');
|
||||
|
||||
table.integer('user_id').unsigned();
|
||||
table.string('code', 64).notNullable();
|
||||
table.boolean('used').defaultTo(false);
|
||||
|
||||
table.foreign('user_id').references('id').inTable('accounts').onUpdate('CASCADE').onDelete('CASCADE');
|
||||
|
||||
table.index('user_id', 'backupcodes_uid');
|
||||
});
|
||||
}
|
||||
|
||||
async down() {
|
||||
this.schema.dropTable(this.tableName);
|
||||
}
|
||||
}
|
||||
|
||||
// CREATE SEQUENCE IF NOT EXISTS gba.backupcodes_id_seq
|
||||
// INCREMENT 1
|
||||
// START 1
|
||||
|
@ -5,7 +30,6 @@
|
|||
// MAXVALUE 2147483647
|
||||
// CACHE 1;
|
||||
|
||||
|
||||
// ALTER SEQUENCE gba.backupcodes_id_seq
|
||||
// OWNER TO tethys_admin;
|
||||
|
||||
|
@ -26,7 +50,6 @@
|
|||
// CONSTRAINT backupcodes_pkey PRIMARY KEY (id)
|
||||
// )
|
||||
|
||||
|
||||
// CREATE INDEX IF NOT EXISTS backupcodes_uid
|
||||
// ON gba.backupcodes USING btree
|
||||
// (user_id ASC);
|
||||
// (user_id ASC);
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue