Database Relationships and Migrations in a Flask App
Get the project source code below, and follow along with the lesson material.
Download Project Source CodeTo set up the project on your local machine, please follow the directions provided in the README.md
file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.
DB Relationships & Migrations
Right now we have two models, Product and User. To build out a store front and process orders, we'll need at least one more model: Store
. We can also add an Order
model if we want to track orders.
Each User
needs to be able to manage one Store
. Each Store
will have multiple Product
s. Every Order
will have one Product
.
This data model is relational, but neither our database nor our models currently reflect that. For example, there is no way to denote that a Product
was created by a specific User
.
This lesson preview is part of the Fullstack Flask: Build a Complete SaaS App with Flask course and can be unlocked immediately with a single-time purchase. Already have access to this course? Log in here.
Get unlimited access to Fullstack Flask: Build a Complete SaaS App with Flask with a single-time purchase.