Renamings
This commit is contained in:
parent
d7e2f0fc0e
commit
4cf3706904
|
@ -49,7 +49,7 @@ export async function save(
|
||||||
|
|
||||||
// check for case sensitivity - we don't want to allow duplicated columns
|
// check for case sensitivity - we don't want to allow duplicated columns
|
||||||
const duplicateColumn = findDuplicateInternalColumns(table, {
|
const duplicateColumn = findDuplicateInternalColumns(table, {
|
||||||
internalRowsAllowed: !!opts?.isImport,
|
ignoreProtectedColumnNames: !oldTable && !!opts?.isImport,
|
||||||
})
|
})
|
||||||
if (duplicateColumn.length) {
|
if (duplicateColumn.length) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
@ -55,7 +55,7 @@ export function canBeSortColumn(type: FieldType): boolean {
|
||||||
|
|
||||||
export function findDuplicateInternalColumns(
|
export function findDuplicateInternalColumns(
|
||||||
table: Table,
|
table: Table,
|
||||||
opts?: { internalRowsAllowed: boolean }
|
opts?: { ignoreProtectedColumnNames: boolean }
|
||||||
): string[] {
|
): string[] {
|
||||||
// maintains the case of keys
|
// maintains the case of keys
|
||||||
const casedKeys = Object.keys(table.schema)
|
const casedKeys = Object.keys(table.schema)
|
||||||
|
@ -72,7 +72,7 @@ export function findDuplicateInternalColumns(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!opts?.internalRowsAllowed) {
|
if (!opts?.ignoreProtectedColumnNames) {
|
||||||
for (let internalColumn of CONSTANT_INTERNAL_ROW_COLS) {
|
for (let internalColumn of CONSTANT_INTERNAL_ROW_COLS) {
|
||||||
if (casedKeys.find(key => key === internalColumn)) {
|
if (casedKeys.find(key => key === internalColumn)) {
|
||||||
duplicates.push(internalColumn)
|
duplicates.push(internalColumn)
|
||||||
|
|
Loading…
Reference in New Issue