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\` + `); + } +}