(Ecto.ConstraintError) constraint error when attempting to insert struct: (foreign_key_constraint)

Hello all, I found the mistake, I had a typo in my migration file.

The typo

add :parent_organization_id, references(:organizations, on_delete: :delete_all)

Should be references(:parent_organizations

The reason it worked on local but not production is because I hadn’t created organizations yet.

Thanks @jesse for helping debug this.