Understanding the role of contexts
We talked a little bit about the sorts of issues that would lead us to want to control how our code is used and written since we don't want maintenance to become a giant hassle for us in the future. Therefore, let's instead simplify our lives by providing a single interface for related schemas and database operations.
Contexts fill that void by providing that unified interface, typically providing human-readable functions that allow the fetching, inserting, updating, and deleting of data. It can also do other database-specific operations that may be difficult to figure out ownership of (for example, should adding a new option to a poll live on the Poll or live on the schema? The correct answer is: neither!).
Overall, the end goal is that when someone else is working on our codebase (or, when we're working on this same codebase six months later and can't remember any of the decisions or code structure rules we originally laid out), we have a very simple way...