mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
* initial commit * multi env changes * multi-env changes * entity fixes * data query changes * fix * trying to avoid conflict with EE * moved version creation to app creation function * fixing some issues * execution of data query * revert options changes * changed migration * fixed some migration issues: testing migration * multi env support * app import export fix * fixes * migration fixes * removed plugins from data query * fixing some migration issues * fixes * remove console log * fix * front end api changes * backward compatibility for app import * Fixed a bug * correcting some mistakes * Added constraints and fixed some issues * changes * fix for data source listing * fixing version operation issues * remove kind from data query * removed kind from data query * fixes * fixes * fix for version creation * migration fixes * Fixed preview and run query issues * Fix: new version and event query id issue * fixed rest api oauth issue - next test refresh token * import export changes * fixes for app import * import fix * added await for for loops * fix * fix for migration * Fixed backend oauth-envId issue * import export changes * migration fixes * fix * fix * fix for app import from 0.9.0 * test case fixes * test case fixes * making app name mandatory for import * adding type for options * fix: imported apps query linking issues * review changes * lint issue fixes * added on delete cascade Co-authored-by: Muhsin Shah <muhsinshah21@gmail.com>
36 lines
1.6 KiB
TypeScript
36 lines
1.6 KiB
TypeScript
import { MigrationInterface, QueryRunner, TableForeignKey } from 'typeorm';
|
|
|
|
export class removeRepetitionInDataSourceAndQuery1669919175280 implements MigrationInterface {
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
// TODO: next version add : await queryRunner.dropColumn('data_sources', 'options');
|
|
await this.dropForeignKey('data_sources', 'app_id', queryRunner);
|
|
await this.dropForeignKey('data_queries', 'app_id', queryRunner);
|
|
await this.dropForeignKey('data_queries', 'app_version_id', queryRunner);
|
|
|
|
await queryRunner.dropColumn('data_sources', 'app_id');
|
|
await queryRunner.dropColumn('data_queries', 'app_id');
|
|
await queryRunner.dropColumn('data_queries', 'app_version_id');
|
|
await queryRunner.dropColumn('data_queries', 'kind');
|
|
await queryRunner.dropColumn('apps', 'definition');
|
|
|
|
//update data sources - add onDelete action to app_version_id
|
|
await this.dropForeignKey('data_sources', 'app_version_id', queryRunner);
|
|
await queryRunner.createForeignKey(
|
|
'data_sources',
|
|
new TableForeignKey({
|
|
columnNames: ['app_version_id'],
|
|
referencedColumnNames: ['id'],
|
|
referencedTableName: 'app_versions',
|
|
onDelete: 'CASCADE',
|
|
})
|
|
);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {}
|
|
|
|
private async dropForeignKey(tableName: string, columnName: string, queryRunner) {
|
|
const table = await queryRunner.getTable(tableName);
|
|
const foreignKey = table.foreignKeys.find((fk) => fk.columnNames.indexOf(columnName) !== -1);
|
|
await queryRunner.dropForeignKey(tableName, foreignKey);
|
|
}
|
|
}
|