Summary
In this chapter, we went over defining relations of models using associative properties along with some advanced options and relational patterns, and we went over the differences between eager loading and lazy loading. At the end of this chapter, we took our lessons from the previous chapter, Validating Models, and added validations, associations, and migrations for our Avalon Airlines project.
Note
If you ever get stuck on associations and need a quick reference, the related material can be found here: https://sequelize.org/docs/v6/core-concepts/assocs/.
In the next chapter, we will go over Sequelize’s hook feature (also known as a life cycle event), how to define hooks for models, and what would be some good use cases for life cycle events.