migration change on default value and encrypted storage
This commit is contained in:
parent
03a5bb3592
commit
a476bf6823
11 changed files with 82 additions and 36 deletions
|
@ -1,5 +1,8 @@
|
|||
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||
import { getDefaultByORM, getTypeByORM } from "./ormHelper";
|
||||
import { LoginRoutineEnum } from "../enums/loginRoutineEnum";
|
||||
import { CodingHelper } from "../helpers/codingHelper";
|
||||
import { APPLICATION_SECRET } from "../env.defaults";
|
||||
|
||||
export class UserLoginRoutine1746252454922 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
|
@ -9,7 +12,11 @@ export class UserLoginRoutine1746252454922 implements MigrationInterface {
|
|||
|
||||
await queryRunner.addColumns("user", [
|
||||
new TableColumn({ name: "secret", ...getTypeByORM("text") }),
|
||||
new TableColumn({ name: "routine", ...getTypeByORM("varchar") }),
|
||||
new TableColumn({
|
||||
name: "routine",
|
||||
...getTypeByORM("varchar"),
|
||||
default: getDefaultByORM("string", LoginRoutineEnum.totp),
|
||||
}),
|
||||
]);
|
||||
|
||||
await queryRunner.manager.getRepository("user").save(users.map((u) => ({ id: u.id, secret: u.secret })));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue