mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
27 lines
791 B
TypeScript
27 lines
791 B
TypeScript
import { MigrationInterface, QueryRunner, TableForeignKey } from 'typeorm';
|
|
|
|
export class addForeignKeyForPlugin1664535394459 implements MigrationInterface {
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.createForeignKey(
|
|
'data_sources',
|
|
new TableForeignKey({
|
|
columnNames: ['plugin_id'],
|
|
referencedColumnNames: ['id'],
|
|
referencedTableName: 'plugins',
|
|
onDelete: 'CASCADE',
|
|
})
|
|
);
|
|
|
|
await queryRunner.createForeignKey(
|
|
'data_queries',
|
|
new TableForeignKey({
|
|
columnNames: ['plugin_id'],
|
|
referencedColumnNames: ['id'],
|
|
referencedTableName: 'plugins',
|
|
onDelete: 'CASCADE',
|
|
})
|
|
);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {}
|
|
}
|