Solution: Use Ecto's Upsert Feature

Go over the solution to the "Using Ecto's Upsert Feature" problem.

We'll cover the following

Solution

The upsert_user function below will be called by our upload script to insert or update a single user record. We are assuming that the params hash contains all fields defined by the schema below. We are further assuming that the email field will be unique.

Get hands-on with 1400+ tech skills courses.