mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-29 17:38:07 +00:00
* add migrations for versioning datasources and dataqueries * eslint migrations folder * update ormconfig to use app context in migrations * make app to make use versioned data sources and queries in editor * app import should honor data source and query versioning * register ts-node path on running migrations * load data queries when finding versions * update e2e tests * handle for invalid oauth2 datasources * update e2e tests * introduce db migrations access lock to handle concurrent backfill * scope migrations by missing version id * fix import export without data source/query versions * fix import * fix spec * handle invalid data on migration * fix import * remove console logs * handle new app imports * fix version check * fix async creation * explicitly add timestamps on version import
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> {}
|
|
}
|