File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,13 +171,11 @@ sanitize_database_name() {
171171
172172 # Database names should only contain alphanumeric and underscores
173173 local sanitized
174- sanitized=$( echo " $name " | sed ' s/[^a-zA-Z0-9_]//g' )
174+ sanitized=$( echo " $name " | sed ' s/[^a-zA-Z0-9_]//g' | sed ' s/^[0-9]/_&/ ' )
175175
176- # Must start with letter or underscore
177- if [[ ! " $sanitized " =~ ^[a-zA-Z_][a-zA-Z0-9_]* $ ]]; then
178- log_error " Invalid database name: $name "
179- log_error " Database name must start with letter or underscore and contain only alphanumeric characters and underscores"
180- exit 1
176+ # Log a warning if the name was modified
177+ if [[ " $sanitized " != " $name " ]]; then
178+ log_warning " Database name modified to conform to requirements: $sanitized "
181179 fi
182180
183181 echo " $sanitized "
You can’t perform that action at this time.
0 commit comments