diff --git a/packages/nc-gui/components/template/Editor.vue b/packages/nc-gui/components/template/Editor.vue index e0b452b6ae..7dfe040ba6 100644 --- a/packages/nc-gui/components/template/Editor.vue +++ b/packages/nc-gui/components/template/Editor.vue @@ -476,6 +476,19 @@ async function importTemplate() { } else { // check if form is valid try { + // Truncate and its column names + const MAX_COLUMN_LEN = 255 + // Truncate table name which less as we need to add prefix to it + const MAX_TABLE_LEN = 52 + for (const table of data.tables) { + table.table_name = table.table_name?.slice(0, MAX_TABLE_LEN) + for (const column of table.columns) { + column.column_name = column.column_name?.slice(0, MAX_COLUMN_LEN) + } + } + + await nextTick() + await validate() } catch (errorInfo) { isImporting.value = false diff --git a/packages/nocodb/src/services/tables.service.ts b/packages/nocodb/src/services/tables.service.ts index 1e1f43b2e1..1546f2f460 100644 --- a/packages/nocodb/src/services/tables.service.ts +++ b/packages/nocodb/src/services/tables.service.ts @@ -461,9 +461,7 @@ export class TablesService { } if (column.column_name.length > mxColumnLength) { - NcError.badRequest( - `Column name ${column.column_name} exceeds ${mxColumnLength} characters`, - ); + column.column_name = column.column_name.slice(0, mxColumnLength); } if (column.title && column.title.length > 255) {