ToolJet/server/data-migrations/1669055405494-removePluginFromDataQuery.ts
2022-12-15 16:01:10 +05:30

20 lines
724 B
TypeScript

import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';
export class removePluginFromDataQuery1669055405494 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumn('data_queries', 'plugin_id');
await queryRunner.query('ALTER TABLE data_queries ALTER COLUMN data_source_id DROP NOT NULL;');
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumn(
'data_queries',
new TableColumn({
name: 'plugin_id',
type: 'uuid',
isNullable: true,
})
);
await queryRunner.query('ALTER TABLE data_queries ALTER COLUMN data_source_id SET NOT NULL;');
}
}