sqlc
sqlc copied to clipboard
support graceful migration for nullable enum types
Version
1.14.0
What happened?
#1485 improved handling of nullable fields with enum type. This is good.
But please consider adding a flag to opt out per-field. This is a backwards incompatible change; upgrading to the latest sqlc will cause code that used to compile not to compile any more. For a large code base, it would be much better to be able to upgrade field by field, rather than having to do one big bang. (There'd still be a big bang to the config file, but that's way safer and more manageable than a sprawling code change.)
Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
No response
Playground URL
No response
What operating system are you using?
No response
What database engines are you using?
No response
What type of code are you generating?
No response
I agree that changes like this aren't great. In this case, I felt it was necessary since these enums represented future errors. If you have a column with a nullable enum type, querying for that value would have always returned an error.
But please consider adding a flag to opt out per-field
While verbose, you can opt-out in certain cases using overrides. You should be able to specify the non-nullable enum type for the nullable value. Happy to provide a sample if necessary.