Browse Source

feat(nocodb): nc_029_alter_hooklog_response_types

pull/5349/head
Wing-Kam Wong 2 years ago
parent
commit
9da494ff31
  1. 4
      packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts
  2. 27
      packages/nocodb/src/lib/migrations/v2/nc_029_alter_hooklog_response_types.ts

4
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;
}
}
}

27
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 };
Loading…
Cancel
Save