2020-07-26 02:33:20 -07:00
import { MigrationInterface , QueryRunner } from "typeorm" ;
2020-07-17 08:08:40 -07:00
2021-06-23 02:20:07 -07:00
import * as config from '../../../../config' ;
2020-07-17 08:08:40 -07:00
export class CreateIndexStoppedAt1594828256133 implements MigrationInterface {
2020-07-26 02:33:20 -07:00
name = 'CreateIndexStoppedAt1594828256133' ;
2020-07-17 08:08:40 -07:00
2020-07-26 02:33:20 -07:00
async up ( queryRunner : QueryRunner ) : Promise < void > {
2020-07-17 08:08:40 -07:00
let tablePrefix = config . get ( 'database.tablePrefix' ) ;
const tablePrefixPure = tablePrefix ;
const schema = config . get ( 'database.postgresdb.schema' ) ;
if ( schema ) {
tablePrefix = schema + '.' + tablePrefix ;
}
await queryRunner . query ( ` CREATE INDEX IF NOT EXISTS IDX_ ${ tablePrefixPure } 33228da131bb1112247cf52a42 ON ${ tablePrefix } execution_entity ("stoppedAt") ` ) ;
2020-07-26 02:33:20 -07:00
}
2020-07-17 08:08:40 -07:00
2020-07-26 02:33:20 -07:00
async down ( queryRunner : QueryRunner ) : Promise < void > {
const tablePrefix = config . get ( 'database.tablePrefix' ) ;
2020-07-17 08:08:40 -07:00
await queryRunner . query ( ` DROP INDEX IDX_ ${ tablePrefix } 33228da131bb1112247cf52a42 ` ) ;
2020-07-26 02:33:20 -07:00
}
2020-07-17 08:08:40 -07:00
}