n8n/packages/cli/src/databases/mysqldb/migrations/1644424784709-AddExecutionEntityIndexes.ts
Iván Ovejero 37a6e329af
🔨 Infer typings for config schema (#2656)
* 🚚 Move schema to standalone file

*  Add assertions to string literal arrays

*  Infer typings for convict schema

* 🔥 Remove unneeded assertions

* 🔨 Fix errors surfaced by typings

*  Type nodes.include/exclude per docs

*  Account for types for exception paths

*  Set method alias to flag incorrect paths

*  Replace original with alias

*  Make allowance for nodes.include

*  Adjust leftover calls

* 🔀 Fix conflicts

* 🔥 Remove unneeded castings

* 📘 Simplify exception path type

* 📦 Update package-lock.json

* 🔥 Remove unneeded imports

* 🔥 Remove unrelated file

*  Update schema

*  Update interface

* 📦 Update package-lock.json

* 📦 Update package-lock.json

* 🔥 Remove leftover assertions

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-04-08 19:37:27 +02:00

72 lines
2.4 KiB
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
import * as config from '../../../../config';
export class AddExecutionEntityIndexes1644424784709 implements MigrationInterface {
name = 'AddExecutionEntityIndexes1644424784709';
public async up(queryRunner: QueryRunner): Promise<void> {
const tablePrefix = config.getEnv('database.tablePrefix');
await queryRunner.query(
'DROP INDEX `IDX_c4d999a5e90784e8caccf5589d` ON `' + tablePrefix + 'execution_entity`',
);
await queryRunner.query(
'DROP INDEX `IDX_ca4a71b47f28ac6ea88293a8e2` ON `' + tablePrefix + 'execution_entity`',
);
await queryRunner.query(
'CREATE INDEX `IDX_06da892aaf92a48e7d3e400003` ON `' +
tablePrefix +
'execution_entity` (`workflowId`, `waitTill`, `id`)',
);
await queryRunner.query(
'CREATE INDEX `IDX_78d62b89dc1433192b86dce18a` ON `' +
tablePrefix +
'execution_entity` (`workflowId`, `finished`, `id`)',
);
await queryRunner.query(
'CREATE INDEX `IDX_1688846335d274033e15c846a4` ON `' +
tablePrefix +
'execution_entity` (`finished`, `id`)',
);
await queryRunner.query(
'CREATE INDEX `IDX_b94b45ce2c73ce46c54f20b5f9` ON `' +
tablePrefix +
'execution_entity` (`waitTill`, `id`)',
);
await queryRunner.query(
'CREATE INDEX `IDX_81fc04c8a17de15835713505e4` ON `' +
tablePrefix +
'execution_entity` (`workflowId`, `id`)',
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
const tablePrefix = config.getEnv('database.tablePrefix');
await queryRunner.query(
'DROP INDEX `IDX_81fc04c8a17de15835713505e4` ON `' + tablePrefix + 'execution_entity`',
);
await queryRunner.query(
'DROP INDEX `IDX_b94b45ce2c73ce46c54f20b5f9` ON `' + tablePrefix + 'execution_entity`',
);
await queryRunner.query(
'DROP INDEX `IDX_1688846335d274033e15c846a4` ON `' + tablePrefix + 'execution_entity`',
);
await queryRunner.query(
'DROP INDEX `IDX_78d62b89dc1433192b86dce18a` ON `' + tablePrefix + 'execution_entity`',
);
await queryRunner.query(
'DROP INDEX `IDX_06da892aaf92a48e7d3e400003` ON `' + tablePrefix + 'execution_entity`',
);
await queryRunner.query(
'CREATE INDEX `IDX_ca4a71b47f28ac6ea88293a8e2` ON `' +
tablePrefix +
'execution_entity` (`waitTill`)',
);
await queryRunner.query(
'CREATE INDEX `IDX_c4d999a5e90784e8caccf5589d` ON `' +
tablePrefix +
'execution_entity` (`workflowId`)',
);
}
}