| Total Complexity | 2 |
| Complexity/F | 1 |
| Lines of Code | 19 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import {MigrationInterface, QueryRunner} from "typeorm"; |
||
| 2 | |||
| 3 | export class Address1586782604399 implements MigrationInterface { |
||
| 4 | name = 'Address1586782604399' |
||
| 5 | |||
| 6 | public async up(queryRunner: QueryRunner): Promise<any> { |
||
| 7 | await queryRunner.query(`CREATE TABLE "address" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "street" character varying NOT NULL, "city" character varying NOT NULL, "zipCode" character varying NOT NULL, "country" character varying NOT NULL, CONSTRAINT "PK_d92de1f82754668b5f5f5dd4fd5" PRIMARY KEY ("id"))`, undefined); |
||
| 8 | await queryRunner.query(`ALTER TABLE "customer" ADD "addressId" uuid`, undefined); |
||
| 9 | await queryRunner.query(`ALTER TABLE "customer" ADD CONSTRAINT "FK_7697a356e1f4b79ab3819839e95" FOREIGN KEY ("addressId") REFERENCES "address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, undefined); |
||
| 10 | } |
||
| 11 | |||
| 12 | public async down(queryRunner: QueryRunner): Promise<any> { |
||
| 13 | await queryRunner.query(`ALTER TABLE "customer" DROP CONSTRAINT "FK_7697a356e1f4b79ab3819839e95"`, undefined); |
||
| 14 | await queryRunner.query(`ALTER TABLE "customer" DROP COLUMN "addressId"`, undefined); |
||
| 15 | await queryRunner.query(`DROP TABLE "address"`, undefined); |
||
| 16 | } |
||
| 17 | |||
| 18 | } |
||
| 19 |