mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
* split data and db migrations * comment audit logs * make prod script to print logs * wrap data migrations in single transaction
25 lines
984 B
TypeScript
25 lines
984 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
import { DataSource } from '../src/entities/data_source.entity';
|
|
|
|
export class TurnOnSSLForEveryPostgresDataSource1630003364070 implements MigrationInterface {
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
const entityManager = queryRunner.manager;
|
|
const queryBuilder = queryRunner.connection.createQueryBuilder();
|
|
const dataSourceRepository = entityManager.getRepository(DataSource);
|
|
|
|
const dataSources = await dataSourceRepository.find({
|
|
where: { kind: 'postgresql' },
|
|
select: ['id', 'options'],
|
|
});
|
|
|
|
for (const dataSource of dataSources) {
|
|
const options = dataSource.options;
|
|
if (options) {
|
|
options['ssl_enabled'] = { value: true, encrypted: false };
|
|
await queryBuilder.update(DataSource).set({ options }).where('id = :id', { id: dataSource.id }).execute();
|
|
}
|
|
}
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {}
|
|
}
|