From 7c76372ff97bc3d10d9be4fa753ac7b1e6282f60 Mon Sep 17 00:00:00 2001 From: Andres Alvarez Date: Sat, 22 Mar 2025 18:43:40 -0400 Subject: [PATCH] Fix migration nullable otp type --- src/user/entities/user-otp.entity.ts | 2 +- src/user/migrations/1742591641706-add-otp-unique-migration.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/user/entities/user-otp.entity.ts b/src/user/entities/user-otp.entity.ts index df2fe18..0219916 100644 --- a/src/user/entities/user-otp.entity.ts +++ b/src/user/entities/user-otp.entity.ts @@ -18,6 +18,6 @@ export class UserOTP extends UUIDModel { @Column({ type: 'timestamp', name: 'expires_at' }) expiresAt: Date; - @Column({ type: 'enum', enum: OTPType }) + @Column({ type: 'enum', enum: OTPType, nullable: true }) type: OTPType; } diff --git a/src/user/migrations/1742591641706-add-otp-unique-migration.ts b/src/user/migrations/1742591641706-add-otp-unique-migration.ts index 43100f6..78850ae 100644 --- a/src/user/migrations/1742591641706-add-otp-unique-migration.ts +++ b/src/user/migrations/1742591641706-add-otp-unique-migration.ts @@ -8,7 +8,7 @@ export class AddOtpUniqueMigration1742591641706 implements MigrationInterface { `CREATE TYPE "public"."user_otp_type_enum" AS ENUM('password-recovery', 'email-validation')`, ); await queryRunner.query( - `ALTER TABLE "user_otp" ADD "type" "public"."user_otp_type_enum" NOT NULL`, + `ALTER TABLE "user_otp" ADD "type" "public"."user_otp_type_enum"`, ); await queryRunner.query( `ALTER TABLE "user_otp" ADD CONSTRAINT "unique_otp_code_per_type" UNIQUE ("code", "type")`,