tethys.backend/database/migrations/acl_4_accounts.ts
Arno Kaimbacher c70fa4a0d8 - aded npm packages @types/qrcode, qrcode and node-f2a
- corrected UsersController.ts and RoleController.ts with correct routes for settings
- added migration script and ui and Controller for 2 Factor Authentication
- npm updates
2023-12-29 15:54:49 +01:00

47 lines
1.8 KiB
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema';
export default class Accounts extends BaseSchema {
protected tableName = 'accounts';
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').primary().defaultTo("nextval('accounts_id_seq')");
table.string('login', 20).notNullable();
table.string('password', 60).notNullable();
table.string('email', 255).unique().notNullable();
table.string('first_name', 255).nullable();
table.string('last_name', 255).nullable();
table.string('remember_token');
table.timestamp('created_at');
table.timestamp('updated_at');
table.text("two_factor_secret").nullable();
table.text("two_factor_recovery_codes").nullable();
});
}
public async down() {
this.schema.dropTable(this.tableName);
}
}
// CREATE TABLE IF NOT EXISTS accounts
// (
// id integer NOT NULL DEFAULT nextval('accounts_id_seq'::regclass),
// login character varying(20) NOT NULL,
// password character varying(60) NOT NULL,
// email character varying(255) NOT NULL,
// first_name character varying(255),
// last_name character varying(255),
// remember_token character varying(100),
// created_at timestamp(0) without time zone,
// updated_at timestamp(0) without time zone,
// CONSTRAINT accounts_pkey PRIMARY KEY (id),
// CONSTRAINT accounts_email_unique UNIQUE (email)
// two_factor_secret text COLLATE pg_catalog."default",
// two_factor_recovery_codes text COLLATE pg_catalog."default",
// )
// ALTER TABLE gba.accounts
// ADD COLUMN two_factor_secret text COLLATE pg_catalog."default",
// ADD COLUMN two_factor_recovery_codes text COLLATE pg_catalog."default";