How to handle references to the ID of a changeset that will be created

I have a schema that is joined with another one via a one-to-many/many-to-one relationship since it has fields in the join table. However, I am trying to figure out how to allow the creation of a new record while filling in that relationship since the join table requires me to input the record’s ID, which isn’t yet created. I’d like ecto to create the ID automatically if that is possible.

I just thought, should I use cast_assoc in this case?

Here’s the code: