Change storage_type of Ash.Type.Term to :binary?
When trying to persist a Term to postgres, I got this error because the term type is string. Changing the storage type/rerunning migrations fixed the issue for me. I can open up a PR if this change seems to make sense to you
** (Postgrex.Error) ERROR 22021 (character_not_in_repertoire) invalid byte sequence for encoding "UTF8": 0x83
6 Replies
Yeah, that makes sense 🙂 Since it wouldn't have worked for users before, I don't think it should be a breaking change.
It’s a bit overkill, but is it within pattern to have data layer specific handling for types? In this case for Term type and the ets datalayer, skipping the term_to_binary and binary_to_term
I think it should eventually be supported, but currently it is not.
We could potentially do it by adding some built in constraints that are always there when type casting
i.e
constraints[:ash][:data_layer]
but we'll have to explore how to make that work with the AshPostgres data layer, for exampleYeah I guess that could naturally come up if a second SQL datalayer was added
Agreed
GitHub
Change storage type of Ash.Type.Term to :binary by georgevanderson ...
Contributor checklist
Bug fixes include regression tests
Chores
Documentation changes
Features include unit/acceptance tests
Refactoring
Update dependencies