This would mean that we would have two fields duplicating type information, add constraints to DB to make sure they are equal and all this just to workaround Ecto limitations. I would rather move type inside payload (which is not ideal for our use cases).
We already have code that makes it possible to have dynamic embeds except you need to call a special “load” function every time schema is returned from DB. This is not very convenient due to Ecto preloads, but works.


















