2022-11-22 05:11:29 -08:00
|
|
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2021-02-08 23:59:32 -08:00
|
|
|
|
2022-11-09 06:25:00 -08:00
|
|
|
import config from '@/config';
|
2021-02-08 23:59:32 -08:00
|
|
|
|
|
|
|
export class MakeStoppedAtNullable1607431743768 implements MigrationInterface {
|
|
|
|
name = 'MakeStoppedAtNullable1607431743768';
|
|
|
|
|
|
|
|
async up(queryRunner: QueryRunner): Promise<void> {
|
2022-04-08 10:37:27 -07:00
|
|
|
let tablePrefix = config.getEnv('database.tablePrefix');
|
|
|
|
const schema = config.getEnv('database.postgresdb.schema');
|
2021-02-08 23:59:32 -08:00
|
|
|
if (schema) {
|
|
|
|
tablePrefix = schema + '.' + tablePrefix;
|
|
|
|
}
|
2022-05-30 02:33:17 -07:00
|
|
|
|
|
|
|
await queryRunner.query(`SET search_path TO ${schema};`);
|
|
|
|
|
2022-11-22 05:11:29 -08:00
|
|
|
await queryRunner.query(
|
|
|
|
'ALTER TABLE ' + tablePrefix + 'execution_entity ALTER COLUMN "stoppedAt" DROP NOT NULL',
|
|
|
|
undefined,
|
|
|
|
);
|
2021-02-08 23:59:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
async down(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
// Cannot be undone as column might already have null values
|
|
|
|
}
|
|
|
|
}
|