2022-01-04 08:04:12 +00:00
|
|
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2021-08-28 03:42:12 +00:00
|
|
|
|
|
|
|
|
export class TurnOnSSLForEveryPostgresDataSource1630003364070 implements MigrationInterface {
|
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
|
const entityManager = queryRunner.manager;
|
|
|
|
|
|
2022-12-09 14:53:42 +00:00
|
|
|
const dataSources = await entityManager.query('select id, options from data_sources where kind = $1', [
|
|
|
|
|
'postgresql',
|
|
|
|
|
]);
|
2021-08-28 03:42:12 +00:00
|
|
|
|
2022-01-04 08:04:12 +00:00
|
|
|
for (const dataSource of dataSources) {
|
2021-08-28 03:42:12 +00:00
|
|
|
const options = dataSource.options;
|
2022-01-04 08:04:12 +00:00
|
|
|
if (options) {
|
2021-08-28 03:42:12 +00:00
|
|
|
options['ssl_enabled'] = { value: true, encrypted: false };
|
2022-12-09 14:53:42 +00:00
|
|
|
await entityManager.query('update data_sources set options = $1 where id = $2', [options, dataSource.id]);
|
2021-08-28 03:42:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-04 08:04:12 +00:00
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {}
|
2021-08-28 03:42:12 +00:00
|
|
|
}
|