PBL6-informative-system / backend /src /migrations /1729864559594-name-phone-not-nullable.ts
AnhLedger's picture
Phone number and email not null when signup
3cd799a
raw
history blame
715 Bytes
import { MigrationInterface, QueryRunner } from "typeorm";
export class NamePhoneNotNullable1729864559594 implements MigrationInterface {
name = 'NamePhoneNotNullable1729864559594'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "full_name" SET NOT NULL`);
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "phone_number" SET NOT NULL`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "phone_number" DROP NOT NULL`);
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "full_name" DROP NOT NULL`);
}
}