Insert with Schemas

Learn how to insert with schemas.

When we first looked at the Repo module, we looked at the insert_all and delete_all functions to insert and delete data. Ecto provides these functions so we can perform these operations without schemas. When working with schemas, Repo has two parallel functions—insert and delete. Let’s take a look at those now. Before we start, if you’ve been running these commands on your local setup, you should run the following to bring your data back into a clean state.

Get hands-on with 1400+ tech skills courses.