You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@TETYYS thanks for filing this - yeah, it's an interesting case where the CLR default (empty string) isn't a valid value for the column type (json). There's an ongoing discussion in dotnet/efcore#21765 about this area, let's wait and see how it pans out there.
Currently, based on dotnet/efcore#21765 (comment), the right way to deal with this is to edit the scaffolded migration and to manually replace the empty string with {}, as above. Right now this is by-design rather than a hacky workaround, though on the EF Core side we may discuss again what happens when a column is made non-nullable.
When migrating from nullable jsonb column to a non-nullable one, migration tries to execute following statements:
This fails with error
invalid input syntax for type json
, as '' is not valid json.Workaround:
Set default value for the column as valid json explicitly:
The text was updated successfully, but these errors were encountered: