Make sure new column name cannot be the same as an existing column name.

This commit is contained in:
Sam Rose 2023-10-25 16:41:37 +01:00
parent c5097487e2
commit e03b1be9d1
No known key found for this signature in database
1 changed files with 2 additions and 2 deletions

View File

@ -17,8 +17,8 @@
$: error = checkNewColumnName(newColumnName) $: error = checkNewColumnName(newColumnName)
const checkNewColumnName = newColumnName => { const checkNewColumnName = newColumnName => {
if (column.schema.name === newColumnName) { if (newColumnName in $definition.schema) {
return "New column name can't be the same as the existing column name." return "New column name can't be the same as an existing column name."
} }
if (newColumnName.match(ValidColumnNameRegex) === null) { if (newColumnName.match(ValidColumnNameRegex) === null) {
return "Illegal character; must be alpha-numeric." return "Illegal character; must be alpha-numeric."