Closed moxley closed 2 days ago
I would suggest making a custom type, which can define the migration type callback in AshPostgres.Type
. Then you can override the :string
type using this config: https://hexdocs.pm/ash/Ash.Type.html#module-short-names
Thanks for the suggestion @zachdaniel. I will try that.
Is your feature request related to a problem? Please describe.
For string database columns that store a smallish size string (i.e., most string columns), I prefer to use the
varchar
type, because that type has a good default maximum size (255), and that type has more predictable behavior across different database engines. I want to restrict the column size by default to prevent DOS attacks that try to flood the database with large amounts of data, or simply to reject too-long user input strings that the application doesn't have proper "max length" validation for. AshPostgres prefers thetext
type, and I'm not sure why.It would be useful if I didn't have to add an entry in
migration_types
every time I add a smallish string attribute.Describe the solution you'd like
Could AshPostgres provide application configuration to make
varchar
a default for string attributes? It could work similarly to how ecto_sql provides configuration for primary key columns.Configuration example:
Describe alternatives you've considered
Add an entry in
migration_types
every time I add a smallish string attribute.