我有一个User模型,has_many医学信息和医学信息belongs_to用户.
当我尝试删除User具有相关记录(医疗信息)的时,Ecto给我以下错误:
** (Ecto.ConstraintError) constraint error when attempting to delete struct:
* foreign_key: medical_informations_user_id_fkey
If you would like to convert this constraint into an error, please
call foreign_key_constraint/3 in your changeset and define the proper
constraint name. The changeset has not defined any constraint.
Run Code Online (Sandbox Code Playgroud)
我试图foreign_key_constraint/3在两个模型中添加到我的默认变更集,但错误仍在继续.