Make sure the user cannot enter the same column name as the old column for the migrated column.

This commit is contained in:
Sam Rose 2023-10-24 17:33:49 +01:00
parent d3670ddf21
commit f4c6ab7f48
No known key found for this signature in database
2 changed files with 9 additions and 2 deletions

View File

@ -18,7 +18,6 @@
export let orderable = true
const {
API,
reorder,
isReordering,
isResizing,

View File

@ -12,6 +12,7 @@
export let column
let newColumnName = `${column.schema.name} (migrated)`
$: newAndOldNameMatch = column.schema.name === newColumnName
const migrateUserColumn = async () => {
let subtype = "users"
@ -43,6 +44,7 @@
confirmText="Continue"
cancelText="Cancel"
onConfirm={migrateUserColumn}
disabled={newAndOldNameMatch}
size="M"
>
This operation will kick off a migration of the column "{column.schema.name}"
@ -54,5 +56,11 @@
header="Are you sure?"
message="This will leave bindings which utilised the user relationship column in a state where they will need to be updated to use the new column instead."
/>
<Input bind:value={newColumnName} label="New column name" />
<Input
bind:value={newColumnName}
label="New column name"
error={newAndOldNameMatch
? "New column name can't be the same as the existing column name"
: undefined}
/>
</ModalContent>