From 80c6ace33ebcc325e226915da2ce8c7357991763 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 22 Feb 2023 18:40:00 +0800 Subject: [PATCH] feat(nocodb): add a migration script nc_026_add_comparison_sub_op to add a new field comparison_sub_op for FILTER_EXP --- .../src/lib/migrations/XcMigrationSourcev2.ts | 4 ++++ .../v2/nc_026_add_comparison_sub_op.ts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 packages/nocodb/src/lib/migrations/v2/nc_026_add_comparison_sub_op.ts diff --git a/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts b/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts index b6e42c5b8c..2f28ae814c 100644 --- a/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts +++ b/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts @@ -13,6 +13,7 @@ import * as nc_022_qr_code_column_type from './v2/nc_022_qr_code_column_type'; import * as nc_023_multiple_source from './v2/nc_023_multiple_source'; import * as nc_024_barcode_column_type from './v2/nc_024_barcode_column_type'; import * as nc_025_add_row_height from './v2/nc_025_add_row_height'; +import * as nc_026_add_comparison_sub_op from './v2/nc_026_add_comparison_sub_op'; // Create a custom migration source class export default class XcMigrationSourcev2 { @@ -37,6 +38,7 @@ export default class XcMigrationSourcev2 { 'nc_023_multiple_source', 'nc_024_barcode_column_type', 'nc_025_add_row_height', + 'nc_026_add_comparison_sub_op', ]); } @@ -76,6 +78,8 @@ export default class XcMigrationSourcev2 { return nc_024_barcode_column_type; case 'nc_025_add_row_height': return nc_025_add_row_height; + case 'nc_026_add_comparison_sub_op': + return nc_026_add_comparison_sub_op; } } } diff --git a/packages/nocodb/src/lib/migrations/v2/nc_026_add_comparison_sub_op.ts b/packages/nocodb/src/lib/migrations/v2/nc_026_add_comparison_sub_op.ts new file mode 100644 index 0000000000..4e43488320 --- /dev/null +++ b/packages/nocodb/src/lib/migrations/v2/nc_026_add_comparison_sub_op.ts @@ -0,0 +1,16 @@ +import { Knex } from 'knex'; +import { MetaTable } from '../../utils/globals'; + +const up = async (knex: Knex) => { + await knex.schema.alterTable(MetaTable.FILTER_EXP, (table) => { + table.string('comparison_sub_op'); + }); +}; + +const down = async (knex) => { + await knex.schema.alterTable(MetaTable.FILTER_EXP, (table) => { + table.dropColumns('comparison_sub_op'); + }); +}; + +export { up, down };