This video is available to students only

Database Relationships and Migrations in a Flask App

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 Products. 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.

Start a new discussion. All notification go to the author.