Wrapping Up: Connect Tables to Elixir Structs with Schemas

Review what we have learned about connecting Elixir structs with schemas.

We'll cover the following

What have we learned?

This chapter taught us how schemas allow us to create data structures that we can map onto our database tables. This is how we’ll be using schemas most of the time, but schemas are very flexible and can be used differently. We’ll be looking at some examples later on in the course.

At the end of the chapter, we saw how schemas make it easy to insert lots of records at once, even records with complex nested associations. However, there’s one issue that we glossed over—making sure that the data we’re inserting is valid and catches any errors that might arise. This is a critical part of maintaining the integrity of our data, and the Changeset module is here to help. We’ll look at that next.

Get hands-on with 1200+ tech skills courses.