Browse Source

fix: Truncate table name and column name in csv import and remove column name db specfic length constraint from table create api

pull/6990/head
Muhammed Mustafa 1 year ago
parent
commit
cb05a757ce
  1. 13
      packages/nc-gui/components/template/Editor.vue
  2. 4
      packages/nocodb/src/services/tables.service.ts

13
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

4
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) {

Loading…
Cancel
Save