From the course: Databases for Node.js Developers
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Creating the order models for Sequelize - Node.js Tutorial
From the course: Databases for Node.js Developers
Creating the order models for Sequelize
- [Instructor] In the previous video, we created the user model. Now we want to create the models for our order management. We will create the order model which represents a single order which is associated with the user, and we will also create the order item model that stores the individual items of each order. Before we start this, I want to do a little optimization on the user object because I had an idea here, let's open User.js first. And you see that I'm bringing in the DataTypes from sequelize, but at the same time I'm also already bringing in sequelize in line three. So actually what we can do is we can remove this line and I will now add an argument, DataTypes. So later when we call and initialize these models, we have to add this as an argument. What we could also do is we could also extract or get DataTypes directly from the sequelize object, but let's leave it like that for clarity. Now we will build the order model. So I closed the use the User.js file and in the…
Contents
-
-
-
-
-
-
(Locked)
Using MySQL for our users and orders1m 8s
-
(Locked)
Setting up MySQL with Docker2m 49s
-
(Locked)
Exploring MySQL with MySQL Workbench1m 57s
-
(Locked)
Introducing Sequelize1m 51s
-
(Locked)
Setting up the database connection7m 43s
-
(Locked)
Designing the database structure2m 1s
-
(Locked)
Creating a user model for Sequelize7m 47s
-
(Locked)
Creating the order models for Sequelize11m 56s
-
(Locked)
Loading and syncing the models13m 5s
-
(Locked)
Creating, updating and deleting users with Sequelize12m 52s
-
(Locked)
Securing credentials with password hashing7m 2s
-
(Locked)
Implementing the user login9m 15s
-
(Locked)
-
-
-