Browse Source

fix: proper column name validation based on base type

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5848/head
Pranav C 2 years ago
parent
commit
f9d498a67f
  1. 6
      packages/nc-gui/composables/useColumnCreateStore.ts
  2. 1
      packages/nc-gui/store/project.ts

6
packages/nc-gui/composables/useColumnCreateStore.ts

@ -31,7 +31,7 @@ interface ValidationsObj {
const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState(
(meta: Ref<TableType | undefined>, column: Ref<ColumnType | undefined>) => {
const projectStore = useProject()
const { isMysql: isMysqlFunc, isPg: isPgFunc, isMssql: isMssqlFunc, isXcdbBase: isXcdbBaseFunc } = projectStore
const { isMysql: isMysqlFunc, isPg: isPgFunc, isMssql: isMssqlFunc, isXcdbBase: isXcdbBaseFunc, getBaseType } = projectStore
const { project, sqlUis } = storeToRefs(projectStore)
const { $api } = useNuxtApp()
@ -54,6 +54,8 @@ const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState
const isXcdbBase = computed(() => isXcdbBaseFunc(meta.value?.base_id ? meta.value?.base_id : Object.keys(sqlUis.value)[0]))
const baseType = computed(() => getBaseType(meta.value?.base_id ? meta.value?.base_id : Object.keys(sqlUis.value)[0]))
const idType = null
const additionalValidations = ref<ValidationsObj>({})
@ -101,7 +103,7 @@ const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState
})
},
},
fieldLengthValidator(project.value?.bases?.[0].type || ClientType.MYSQL),
fieldLengthValidator(baseType.value || ClientType.MYSQL),
],
uidt: [
{

1
packages/nc-gui/store/project.ts

@ -227,5 +227,6 @@ export const useProject = defineStore('projectStore', () => {
isXcdbBase,
hasEmptyOrNullFilters,
setProject,
getBaseType,
}
})

Loading…
Cancel
Save