PBL6-informative-system / backend /src /migrations /1731146081011-create-branch-id.ts
AnhLedger's picture
see list of user
439f1c8
raw
history blame contribute delete
792 Bytes
import { MigrationInterface, QueryRunner } from "typeorm";
export class CreateBranchId1731146081011 implements MigrationInterface {
name = 'CreateBranchId1731146081011'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "users" ADD "branch_id" character varying`);
await queryRunner.query(`ALTER TABLE "users" ADD CONSTRAINT "FK_5a58f726a41264c8b3e86d4a1de" FOREIGN KEY ("branch_id") REFERENCES "branches"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "users" DROP CONSTRAINT "FK_5a58f726a41264c8b3e86d4a1de"`);
await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "branch_id"`);
}
}