-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Janderson Souza Matias
authored and
Janderson Souza Matias
committed
Jun 17, 2024
1 parent
1de591e
commit ba28a17
Showing
11 changed files
with
142 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class Migrations1718665191767 implements MigrationInterface { | ||
name = "Migrations1718665191767"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE "login_attempt" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "email" character varying NOT NULL, "created_at" bigint NOT NULL, CONSTRAINT "PK_72829cd4f7424e3cdfd46c476c0" PRIMARY KEY ("id"))` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "user" ADD "force_logout" boolean NOT NULL DEFAULT false` | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "force_logout"`); | ||
await queryRunner.query(`DROP TABLE "login_attempt"`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class Migrations1718665323971 implements MigrationInterface { | ||
name = "Migrations1718665323971"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "login_attempt" DROP COLUMN "created_at"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "login_attempt" ADD "created_at" TIMESTAMP NOT NULL DEFAULT now()` | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "session" DROP CONSTRAINT "FK_5351647a4a00ccbca90adb057f6"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "login_attempt" DROP COLUMN "created_at"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "login_attempt" ADD "created_at" bigint NOT NULL` | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class Migrations1718665677392 implements MigrationInterface { | ||
name = "Migrations1718665677392"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "login_attempt" DROP COLUMN "created_at"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "login_attempt" ADD "created_at" bigint NOT NULL` | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "login_attempt" DROP COLUMN "created_at"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "login_attempt" ADD "created_at" TIMESTAMP NOT NULL DEFAULT now()` | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { | ||
Column, | ||
CreateDateColumn, | ||
Entity, | ||
PrimaryGeneratedColumn, | ||
} from "typeorm"; | ||
|
||
@Entity() | ||
export class LoginAttempt { | ||
constructor(otp?: Partial<LoginAttempt>) { | ||
Object.assign(this, otp); | ||
} | ||
|
||
@PrimaryGeneratedColumn("uuid") | ||
id?: string; | ||
|
||
@Column() | ||
email?: string; | ||
|
||
@Column({ type: "bigint" }) | ||
created_at?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters