| 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 Event1617724003673 implements MigrationInterface { |
||
| 4 | name = 'Event1617724003673' |
||
| 5 | |||
| 6 | public async up(queryRunner: QueryRunner): Promise<void> { |
||
| 7 | await queryRunner.query(`CREATE TABLE "event" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "date" TIMESTAMP NOT NULL, "summary" character varying, "schoolId" uuid NOT NULL, "photographerId" uuid NOT NULL, CONSTRAINT "PK_30c2f3bbaf6d34a55f8ae6e4614" PRIMARY KEY ("id"))`); |
||
| 8 | await queryRunner.query(`ALTER TABLE "event" ADD CONSTRAINT "FK_e4d1b1384d9f0d65a116523f8bd" FOREIGN KEY ("schoolId") REFERENCES "school"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); |
||
| 9 | await queryRunner.query(`ALTER TABLE "event" ADD CONSTRAINT "FK_b433cf0b27b9d6ec873f07203dd" FOREIGN KEY ("photographerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); |
||
| 10 | } |
||
| 11 | |||
| 12 | public async down(queryRunner: QueryRunner): Promise<void> { |
||
| 13 | await queryRunner.query(`ALTER TABLE "event" DROP CONSTRAINT "FK_b433cf0b27b9d6ec873f07203dd"`); |
||
| 14 | await queryRunner.query(`ALTER TABLE "event" DROP CONSTRAINT "FK_e4d1b1384d9f0d65a116523f8bd"`); |
||
| 15 | await queryRunner.query(`DROP TABLE "event"`); |
||
| 16 | } |
||
| 17 | |||
| 18 | } |
||
| 19 |