-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 8 additions & 9 deletions
17
packages/functions/src/typeorm/migrations/1705141629515-message_to_rating.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class MessageToRating1705141629515 implements MigrationInterface { | ||
name = 'MessageToRating1705141629515' | ||
name = 'MessageToRating1705141629515' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "event_rating" ADD "message" nvarchar(255)`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "event_rating" DROP COLUMN "message"`); | ||
} | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "event_rating" ADD "message" nvarchar(255)`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "event_rating" DROP COLUMN "message"`) | ||
} | ||
} |
49 changes: 30 additions & 19 deletions
49
packages/functions/src/typeorm/migrations/1705251815793-add_rating_result.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddRatingResult1705251815793 implements MigrationInterface { | ||
name = 'AddRatingResult1705251815793' | ||
name = 'AddRatingResult1705251815793' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE "rating_result" ("id" int NOT NULL IDENTITY(1,1), "parentId" int, "eventId" int NOT NULL, "stageId" int, "criterionId" int, "categoryId" int, "items" nvarchar(255) NOT NULL, CONSTRAINT "PK_cdb2f177c64795e2c911de17df7" PRIMARY KEY ("id"))`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_eacb4b10b2b33ef0648a264cd21" FOREIGN KEY ("parentId") REFERENCES "rating_result"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_e1b3811b7603ca79f37c476dfc6" FOREIGN KEY ("eventId") REFERENCES "event"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_637a0e96aa44f923e403b90bf4d" FOREIGN KEY ("stageId") REFERENCES "stage"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_b8e92010b73ef6b5d531066ddb9" FOREIGN KEY ("criterionId") REFERENCES "criterion"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_aac143e39399d12911644288a36" FOREIGN KEY ("categoryId") REFERENCES "category"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_aac143e39399d12911644288a36"`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_b8e92010b73ef6b5d531066ddb9"`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_637a0e96aa44f923e403b90bf4d"`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_e1b3811b7603ca79f37c476dfc6"`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_eacb4b10b2b33ef0648a264cd21"`); | ||
await queryRunner.query(`DROP TABLE "rating_result"`); | ||
} | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE "rating_result" ("id" int NOT NULL IDENTITY(1,1), "parentId" int, "eventId" int NOT NULL, "stageId" int, "criterionId" int, "categoryId" int, "items" nvarchar(255) NOT NULL, CONSTRAINT "PK_cdb2f177c64795e2c911de17df7" PRIMARY KEY ("id"))` | ||
) | ||
await queryRunner.query( | ||
`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_eacb4b10b2b33ef0648a264cd21" FOREIGN KEY ("parentId") REFERENCES "rating_result"("id") ON DELETE NO ACTION ON UPDATE NO ACTION` | ||
) | ||
await queryRunner.query( | ||
`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_e1b3811b7603ca79f37c476dfc6" FOREIGN KEY ("eventId") REFERENCES "event"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
) | ||
await queryRunner.query( | ||
`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_637a0e96aa44f923e403b90bf4d" FOREIGN KEY ("stageId") REFERENCES "stage"("id") ON DELETE NO ACTION ON UPDATE NO ACTION` | ||
) | ||
await queryRunner.query( | ||
`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_b8e92010b73ef6b5d531066ddb9" FOREIGN KEY ("criterionId") REFERENCES "criterion"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
) | ||
await queryRunner.query( | ||
`ALTER TABLE "rating_result" ADD CONSTRAINT "FK_aac143e39399d12911644288a36" FOREIGN KEY ("categoryId") REFERENCES "category"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_aac143e39399d12911644288a36"`) | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_b8e92010b73ef6b5d531066ddb9"`) | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_637a0e96aa44f923e403b90bf4d"`) | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_e1b3811b7603ca79f37c476dfc6"`) | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP CONSTRAINT "FK_eacb4b10b2b33ef0648a264cd21"`) | ||
await queryRunner.query(`DROP TABLE "rating_result"`) | ||
} | ||
} |
21 changes: 10 additions & 11 deletions
21
packages/functions/src/typeorm/migrations/1705347424162-rating_result_items_text.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class RatingResultItemsText1705347424162 implements MigrationInterface { | ||
name = 'RatingResultItemsText1705347424162' | ||
name = 'RatingResultItemsText1705347424162' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP COLUMN "items"`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" ADD "items" text NOT NULL`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP COLUMN "items"`); | ||
await queryRunner.query(`ALTER TABLE "rating_result" ADD "items" nvarchar(255) NOT NULL`); | ||
} | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP COLUMN "items"`) | ||
await queryRunner.query(`ALTER TABLE "rating_result" ADD "items" text NOT NULL`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "rating_result" DROP COLUMN "items"`) | ||
await queryRunner.query(`ALTER TABLE "rating_result" ADD "items" nvarchar(255) NOT NULL`) | ||
} | ||
} |