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")`,