From 9da494ff315b0d40a064cd4bfccf25335db0685e Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 24 Mar 2023 17:21:53 +0800 Subject: [PATCH] feat(nocodb): nc_029_alter_hooklog_response_types --- .../src/lib/migrations/XcMigrationSourcev2.ts | 4 +++ .../v2/nc_029_alter_hooklog_response_types.ts | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 packages/nocodb/src/lib/migrations/v2/nc_029_alter_hooklog_response_types.ts diff --git a/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts b/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts index 239b89529a..c5d65a7100 100644 --- a/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts +++ b/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts @@ -16,6 +16,7 @@ import * as nc_025_add_row_height from './v2/nc_025_add_row_height'; import * as nc_026_map_view from './v2/nc_026_map_view'; import * as nc_027_add_comparison_sub_op from './v2/nc_027_add_comparison_sub_op'; import * as nc_028_add_enable_scanner_in_form_columns_meta_table from './v2/nc_026_add_enable_scanner_in_form_columns_meta_table'; +import * as nc_029_alter_hooklog_response_types from './v2/nc_029_alter_hooklog_response_types'; // Create a custom migration source class export default class XcMigrationSourcev2 { @@ -43,6 +44,7 @@ export default class XcMigrationSourcev2 { 'nc_026_map_view', 'nc_027_add_comparison_sub_op', 'nc_028_add_enable_scanner_in_form_columns_meta_table', + 'nc_029_alter_hooklog_response_types', ]); } @@ -88,6 +90,8 @@ export default class XcMigrationSourcev2 { return nc_027_add_comparison_sub_op; case 'nc_028_add_enable_scanner_in_form_columns_meta_table': return nc_028_add_enable_scanner_in_form_columns_meta_table; + case 'nc_029_alter_hooklog_response_types': + return nc_029_alter_hooklog_response_types; } } } diff --git a/packages/nocodb/src/lib/migrations/v2/nc_029_alter_hooklog_response_types.ts b/packages/nocodb/src/lib/migrations/v2/nc_029_alter_hooklog_response_types.ts new file mode 100644 index 0000000000..3aaff5d397 --- /dev/null +++ b/packages/nocodb/src/lib/migrations/v2/nc_029_alter_hooklog_response_types.ts @@ -0,0 +1,27 @@ +import { MetaTable } from '../../utils/globals'; +import type { Knex } from 'knex'; + +const up = async (knex: Knex) => { + if (knex.client.config.client === 'mssql') { + await knex.schema.alterTable(MetaTable.HOOK_LOGS, (table) => { + table.dropColumn('response'); + }); + await knex.schema.alterTable(MetaTable.HOOK_LOGS, (table) => { + table.text('response'); + }); + } else if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable(MetaTable.HOOK_LOGS, (table) => { + table.text('response').alter(); + }); + } +}; + +const down = async (knex) => { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable(MetaTable.HOOK_LOGS, (table) => { + table.boolean('response').alter(); + }); + } +}; + +export { up, down };