swiss_schema
swiss_schema copied to clipboard
Should `c:insert/2`, `c:insert!/2`, `c:update/2`, and others validate changes thru changesets?
I just noticed that most repo mutating callback functions validate structs through the schema module's respective changeset/2
, which is different than what happens when Repo.insert/2
is used. I'm not sure what to do in this case.
Should it validate all changes through changeset/2
or should they dangerously allow inserts directly, without caring with changeset validations (effectively delegating it to the respective functions)?