In this chapter, we not only understood what Ecto is, but also applied its four main concepts–Repository, Schemas, Changesets, and Queries–to our ElixirDrip umbrella project:
- We configured the application repository so we could connect (with the help of the Ecto adapter and the database driver) to our PostgreSQL database
- We defined the schemas that represent our database tables
- We learned how to use changesets to validate the changes made to information stored in the database
- We queried our data in many different ways, from schemaless queries to aggregate ones, using SQL functions abstracted by Ecto and others that need to be run through Ecto fragments
During this journey, we introduced, and later ran, migrations that allowed us to mould the structure of our database by creating the tables and constraints we needed. Among these changes were the foreign key constraints that shaped the relationship between the ElixirDrip schemas. We implemented a many-to-many relationship between users...