mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 13:37:28 +00:00
* add: columns and migrations for data queries and sources * add: migrations for app environments * fix: datasources and queries api * fix: import apis * add: radixui colors * create: global datasource page * fix: version creation not including global datasources queries * fix: version deletion failure * fix: ui and other bugs * add: check for abilities on global ds * fix: bugs * fix: existing test cases * fix: migration and bugs * fix: rest api oauthorize bugs * hide: add button for local ds * fix: query bugs * fix: new organization environment creation * fix: local ds label showing for new apps * fix: on page load queries for preview app and published app * fix: import bugs from v1 * fix: merge conflicts * fix: import apis * fix: apss with mulit envs * fix: ui bugs * fix: environments not being created on db:seed * fix: ui bugs * fix: route settings for global datasources * fix: customer dashboard template * fix: local ds queries not being saved * fix: runpy issues * changes: ui * fix: migration issues * fix: ui * hide datasources when no local datasources * fix: test cases * fix: unit test cases and global queries on app import/export * cleanup * add: package-lock file * undo: migration rename * cleanup * fix: ui bugs * migration fixes * fix: dark mode issues * fix: change datasource failing on query create mode * fix: workspace selector issues * fix: clickoutside for change scope option * migration changes * fix: open api issue * reverting configs changes * [Fix] Global datasources & Environment Id issue (#5830) * fix: oauth env id issue * code changes --------- Co-authored-by: gsmithun4 <gsmithun4@gmail.com> Co-authored-by: Muhsin Shah <muhsinshah21@gmail.com>
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
export class BackfillAppVersionToDataQueries1675368628727 implements MigrationInterface {
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
const entityManager = queryRunner.manager;
|
|
let progress = 0;
|
|
|
|
const appVersions = await entityManager.query(
|
|
'select distinct(data_sources.app_version_id) from data_queries inner join data_sources on data_queries.data_source_id = data_sources.id'
|
|
);
|
|
|
|
const queryToAppVersionMap = await entityManager.query(
|
|
'select data_queries.id, data_sources.app_version_id from data_queries inner join data_sources on data_queries.data_source_id = data_sources.id'
|
|
);
|
|
|
|
console.log(`App versions found : ${appVersions?.length || 0}`);
|
|
|
|
if (queryToAppVersionMap?.length) {
|
|
for (const { app_version_id: appVersion } of appVersions) {
|
|
progress++;
|
|
console.log(
|
|
`BackfillAppVersionToDataQueries1675368628727 Progress ${Math.round((progress / appVersions.length) * 100)} %`
|
|
);
|
|
|
|
const queries = queryToAppVersionMap?.filter((query) => query.app_version_id === appVersion);
|
|
if (queries?.length) {
|
|
await entityManager.query(
|
|
`update data_queries set app_version_id = $1 where id IN(${queries.map((dq) => `'${dq.id}'`)?.join()})`,
|
|
[appVersion]
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {}
|
|
}
|