Chapter 3. Building the Data Schema
The data layer covers a lot, so it’s awesome that we have so many good tools to work with. Regardless of the tools you choose, you do need to understand what’s going on beneath the surface. When you start building your data schema, take your time to really write it out. The data schema drives everything for the app and any of its dependencies. Over time, it can become hard to update the schema without breaking everything.
Since you’ve already decided what kind of backend architecture to go with, you probably have an idea of how data will be related and what that data looks like. Making a diagram of how the data will be connected is going to help you and the team a lot because you’ll see the relationships.
That’s why this chapter is going to cover:
-
Initial considerations for setting up the data schema
-
Setting up a database
-
Using object relational mapping (ORM) tools
-
Writing data migrations in your database
-
Seeding the database with initial data
You want to be as detailed as you can and document as much of the business logic as possible. You’ll also want to get feedback from the team in small intervals because the schema can get complex as the app grows. Make sure everyone understands how and where data is being stored and why. By the time you finish this chapter, you’ll have a good foundation for how to build out your data schema.
Initial Considerations
To build out your data layer, you’ll go through these basic steps:
-
Make a diagram ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access