Defaults for embed_one

Hi there,

in my use case I want to add a list of flags/booleans to our user model. I choosed to use a map type in the migration and an Embedded Schema. My problem is, that I don’t want to migrate all users and add the embedded model.

Is it possible to set it on loading like a default?

The Flags that I put there are going to be extended as well. And I don’t want to add the new flags to each user. Will the default value be used or is it just used in Changeset.cast?

Thx

Sorry, I maybe asked too quickly. Solved it myself.

I set a default value on the map-field in the migration, so the embedded model is always there. The values for the flags are set to the default. So that works.

4 Likes