mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
28 lines
793 B
TypeScript
28 lines
793 B
TypeScript
|
|
import { MigrationInterface, QueryRunner, TableColumn, TableForeignKey } from 'typeorm';
|
||
|
|
|
||
|
|
export class AddAppVersionIdColumnToDataSources1639645231497 implements MigrationInterface {
|
||
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.addColumn(
|
||
|
|
'data_sources',
|
||
|
|
new TableColumn({
|
||
|
|
name: 'app_version_id',
|
||
|
|
type: 'uuid',
|
||
|
|
isNullable: true,
|
||
|
|
})
|
||
|
|
);
|
||
|
|
|
||
|
|
await queryRunner.createForeignKey(
|
||
|
|
'data_sources',
|
||
|
|
new TableForeignKey({
|
||
|
|
columnNames: ['app_version_id'],
|
||
|
|
referencedColumnNames: ['id'],
|
||
|
|
referencedTableName: 'app_versions',
|
||
|
|
})
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.dropColumn('data_sources', 'app_version_id');
|
||
|
|
}
|
||
|
|
}
|