@@ -113,13 +113,13 @@ defmodule Core.Schema.ConsoleInstance do
113
113
|> cast ( attrs , @ valid )
114
114
|> cast_embed ( :configuration , with: & configuration_changeset / 2 )
115
115
|> cast_embed ( :instance_status , with: & status_changeset / 2 )
116
- |> validate_required ( @ valid -- ~w( external_id postgres_id cluster_id) a )
116
+ |> validate_required ( @ valid -- ~w( external_id name postgres_id cluster_id) a )
117
117
|> foreign_key_constraint ( :cluster_id )
118
118
|> foreign_key_constraint ( :postgres_id )
119
119
|> foreign_key_constraint ( :owner_id )
120
120
|> unique_constraint ( :subdomain )
121
121
|> unique_constraint ( :name )
122
- |> validate_format ( :name , ~r/ [a-z][a-z0-9]{5,10} / , message: "must be an alphanumeric string between 5 and 11 characters" )
122
+ |> validate_format ( :name , ~r/ ^ [a-z][a-z0-9-]{4,14}$ / , message: "must be an alphanumeric string between 5 and 15 characters, hyphens allowed " )
123
123
|> validate_region ( )
124
124
end
125
125
@@ -133,7 +133,7 @@ defmodule Core.Schema.ConsoleInstance do
133
133
|> foreign_key_constraint ( :owner_id )
134
134
|> unique_constraint ( :subdomain )
135
135
|> unique_constraint ( :name )
136
- |> validate_format ( :name , ~r/ [a-z][a-z0-9]{5,10} / , message: "must be an alphanumeric string between 5 and 11 characters" )
136
+ |> validate_format ( :name , ~r/ ^ [a-z][a-z0-9-]{4,14}$ / , message: "must be an alphanumeric string between 5 and 15 characters, hyphens allowed " )
137
137
|> validate_region ( )
138
138
end
139
139
0 commit comments