From 87bb763069b45bc870453c48c6ef2514128f1e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AF=97=E4=BA=BA=E7=9A=84=E5=92=B8=E9=B1=BC?= Date: Fri, 27 May 2022 15:53:52 +0800 Subject: [PATCH] fix: alter_hooklog_payload_types --- .../lib/noco/common/XcMigrationSourcev2.ts | 6 ++- .../nc_016_alter_hooklog_payload_types.ts | 42 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 packages/nocodb/src/lib/noco/migrationsv2/nc_016_alter_hooklog_payload_types.ts diff --git a/packages/nocodb/src/lib/noco/common/XcMigrationSourcev2.ts b/packages/nocodb/src/lib/noco/common/XcMigrationSourcev2.ts index 63405c2084..f9e14a9bbb 100644 --- a/packages/nocodb/src/lib/noco/common/XcMigrationSourcev2.ts +++ b/packages/nocodb/src/lib/noco/common/XcMigrationSourcev2.ts @@ -3,6 +3,7 @@ import * as nc_012_alter_column_data_types from '../migrationsv2/nc_012_alter_co import * as nc_013_sync_source from '../migrationsv2/nc_013_sync_source'; import * as nc_014_alter_column_data_types from '../migrationsv2/nc_014_alter_column_data_types'; import * as nc_015_add_meta_col_in_column_table from '../migrationsv2/nc_015_add_meta_col_in_column_table'; +import * as nc_016_alter_hooklog_payload_types from '../migrationsv2/nc_016_alter_hooklog_payload_types'; // Create a custom migration source class export default class XcMigrationSourcev2 { @@ -16,7 +17,8 @@ export default class XcMigrationSourcev2 { 'nc_012_alter_column_data_types', 'nc_013_sync_source', 'nc_014_alter_column_data_types', - 'nc_015_add_meta_col_in_column_table' + 'nc_015_add_meta_col_in_column_table', + 'nc_016_alter_hooklog_payload_types' ]); } @@ -36,6 +38,8 @@ export default class XcMigrationSourcev2 { return nc_014_alter_column_data_types; case 'nc_015_add_meta_col_in_column_table': return nc_015_add_meta_col_in_column_table; + case 'nc_016_alter_hooklog_payload_types': + return nc_016_alter_hooklog_payload_types; } } } diff --git a/packages/nocodb/src/lib/noco/migrationsv2/nc_016_alter_hooklog_payload_types.ts b/packages/nocodb/src/lib/noco/migrationsv2/nc_016_alter_hooklog_payload_types.ts new file mode 100644 index 0000000000..962d842a34 --- /dev/null +++ b/packages/nocodb/src/lib/noco/migrationsv2/nc_016_alter_hooklog_payload_types.ts @@ -0,0 +1,42 @@ +import Knex from 'knex'; +import { MetaTable } from '../../utils/globals'; + +const up = async (knex: Knex) => { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable(MetaTable.HOOK_LOGS, table => { + table.text('payload').alter(); + }); + } +}; + +const down = async knex => { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable(MetaTable.HOOK_LOGS, table => { + table.boolean('payload').alter(); + }); + } +}; + +export { up, down }; + +/** + * @copyright Copyright (c) 2022, Xgene Cloud Ltd + * + * @author Wing-Kam Wong + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */