n8n/packages/cli/src/databases/mysqldb/migrations/1594902918301-CreateIndexStoppedAt.ts
Ben Hesseldieck ebe2775701
Add index stopped at (#766)
* 🚧 add index on sqlite

* 🚧 add migration for postgres

* 🚧 add mysql migration

* 🚧 add mongodb migration

*  revert change of default postgresdb user
2020-07-17 17:08:40 +02:00

21 lines
790 B
TypeScript

import {MigrationInterface, QueryRunner} from "typeorm";
import * as config from '../../../../config';
export class CreateIndexStoppedAt1594902918301 implements MigrationInterface {
name = 'CreateIndexStoppedAt1594902918301'
public async up(queryRunner: QueryRunner): Promise<void> {
const tablePrefix = config.get('database.tablePrefix');
await queryRunner.query('CREATE INDEX `IDX_' + tablePrefix + 'cefb067df2402f6aed0638a6c1` ON `' + tablePrefix + 'execution_entity` (`stoppedAt`)');
}
public async down(queryRunner: QueryRunner): Promise<void> {
const tablePrefix = config.get('database.tablePrefix');
await queryRunner.query('DROP INDEX `IDX_' + tablePrefix + 'cefb067df2402f6aed0638a6c1` ON `' + tablePrefix + 'execution_entity`');
}
}