From bc53ca49fcf953e3d282a2ca47d4be7cf3d42c75 Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Fri, 3 Jul 2026 13:32:09 +0200 Subject: [PATCH] feat: flag invalid migration name with red border, not just empty Co-Authored-By: Claude Opus 4.8 (1M context) --- .../workspaceSettings/NewDataTableMigrationModal.svelte | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/components/workspaceSettings/NewDataTableMigrationModal.svelte b/frontend/src/lib/components/workspaceSettings/NewDataTableMigrationModal.svelte index 903302a785..724db72ca4 100644 --- a/frontend/src/lib/components/workspaceSettings/NewDataTableMigrationModal.svelte +++ b/frontend/src/lib/components/workspaceSettings/NewDataTableMigrationModal.svelte @@ -42,6 +42,9 @@ let tab = $state('up') let name = $state('') let nameInput = $state() + // A valid migration name is non-empty and limited to letters, digits, '_' and '-'. + const MIGRATION_NAME_RE = /^[a-zA-Z0-9_-]+$/ + let nameInvalid = $derived(!MIGRATION_NAME_RE.test(name.trim())) let codeUp = $state('') let enableDown = $state(false) let codeDown = $state('') @@ -80,7 +83,7 @@ sendUserToast('Migration name is required', true) return } - if (!/^[a-zA-Z0-9_-]+$/.test(name.trim())) { + if (!MIGRATION_NAME_RE.test(name.trim())) { sendUserToast("Invalid migration name: use only letters, digits, '_' and '-'", true) return } @@ -143,7 +146,7 @@