diff --git a/packages/builder/src/components/backend/ModelNavigator/popovers/EditTablePopover.svelte b/packages/builder/src/components/backend/ModelNavigator/popovers/EditTablePopover.svelte
index 028b78a1e8..36ccbb4800 100644
--- a/packages/builder/src/components/backend/ModelNavigator/popovers/EditTablePopover.svelte
+++ b/packages/builder/src/components/backend/ModelNavigator/popovers/EditTablePopover.svelte
@@ -11,6 +11,8 @@
let dropdown
let editing
let confirmDeleteDialog
+ let error = ""
+ let originalName = table.name
$: fields = Object.keys(table.schema)
@@ -39,6 +41,15 @@
notifier.success("Table renamed successfully")
hideEditor()
}
+
+ function checkValid(evt) {
+ const tableName = evt.target.value
+ if (originalName !== tableName && $backendUiStore.models.some(model => model.name === tableName)) {
+ error = `Table with name ${tableName} already exists. Please choose another name.`
+ return
+ }
+ error = ""
+ }