Method: App42::Base::Util#validate_database_name

Defined in:
lib/app42/base/util.rb

#validate_database_name(name, str) ⇒ Object

Check whether database name is valid OR not database name length should not be more than 64 character And should not contain any special character



340
341
342
343
344
345
346
347
348
349
350
# File 'lib/app42/base/util.rb', line 340

def validate_database_name name, str
  if str.match(App42::DBNAME_REGEX) || str.length > 64 || (numeric_including_zero? str)
    message "Invalid database name. Should be less than 64 characters (Alphabets, alphanumeric and underscore(_) is allowed).", true, 'red'
    return false
  elsif App42::DATABASE_NAME_NOT_ALLOWED.include? str
    message "Database Name should not be '#{str}'.", true, 'red'
    return false
  else
    return str
  end
end