Open jpulec opened 3 years ago
Hi @jpulec, Interesting suggestion, I like it. It would definitely be useful to have this kind of support somehow.
For the '{}'::jsonb
case, a cool solution would be to introspect the models, and determine how to interpret AddDefaultValue.value
depending on the Field
class that is used for the targeted field :)
I've run into a couple scenarios where allowing the use of a raw string to be used as a default would be useful. For example to call an unsupported function, like
generate_uuid_v4()
or to specify a default for a specific type, i.e.'{}'::jsonb
as a default for a JSONB column.Would it make sense to support passing a 'raw' string that wouldn't be escaped when generating the default expression?