From 8e15da95d67e6f55c6527ffcef23b703ff5e982a Mon Sep 17 00:00:00 2001 From: metal Date: Sat, 25 Sep 2021 09:14:17 +0000 Subject: [PATCH] add script --- ...499-ExpandCounterTriggerConditionFields.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 backend/src/migrations/1632560756499-ExpandCounterTriggerConditionFields.ts diff --git a/backend/src/migrations/1632560756499-ExpandCounterTriggerConditionFields.ts b/backend/src/migrations/1632560756499-ExpandCounterTriggerConditionFields.ts new file mode 100644 index 00000000..3bfb8801 --- /dev/null +++ b/backend/src/migrations/1632560756499-ExpandCounterTriggerConditionFields.ts @@ -0,0 +1,21 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class ExpandCounterTriggerConditionFields1632560756499 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + // INT(11) -> INT(32) + await queryRunner.query(` + ALTER TABLE \`counter_triggers\` + CHANGE COLUMN \`comparison_value\` \`comparison_value\` INT(32) NOT NULL AFTER \`comparison_op\`, + CHANGE COLUMN \`reverse_comparison_value\` \`reverse_comparison_value\` INT(32) NOT NULL AFTER \`reverse_comparison_op\` + `); + } + + public async down(queryRunner: QueryRunner): Promise { + // INT(32) -> INT(11) + await queryRunner.query(` + ALTER TABLE \`counter_triggers\` + CHANGE COLUMN \`comparison_value\` \`comparison_value\` INT(11) NOT NULL AFTER \`comparison_op\`, + CHANGE COLUMN \`reverse_comparison_value\` \`reverse_comparison_value\` INT(11) NOT NULL AFTER \`reverse_comparison_op\` + `); + } +}