O'Reilly logo

Programming Phoenix by Jose Valim, Bruce Tate, Chris McCord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7Ecto Queries and Constraints

In the last chapter, we extended our application domain by associating videos to users. Now we’ll let users organize their videos with categories. We want our users to select which category a video belongs to upon video creation. To build this feature, you’ll need to learn more about Ecto queries and the different ways you can retrieve data from the database.

We want to build our feature safely so that corrupt data can’t creep into our database, so we’ll spend some time working with database constraints. Database engines like Postgres are called relational for a reason. A tremendous amount of time and effort has gone into tools and features that help developers define and enforce the relationships between ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required