课程: Databases for Node.js Developers
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Creating the order models for Sequelize - Node.js教程
课程: 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…
内容
-
-
-
-
-
-
(已锁定)
Using MySQL for our users and orders1 分钟 8 秒
-
(已锁定)
Setting up MySQL with Docker2 分钟 49 秒
-
(已锁定)
Exploring MySQL with MySQL Workbench1 分钟 57 秒
-
(已锁定)
Introducing Sequelize1 分钟 51 秒
-
(已锁定)
Setting up the database connection7 分钟 43 秒
-
(已锁定)
Designing the database structure2 分钟 1 秒
-
(已锁定)
Creating a user model for Sequelize7 分钟 47 秒
-
(已锁定)
Creating the order models for Sequelize11 分钟 56 秒
-
(已锁定)
Loading and syncing the models13 分钟 5 秒
-
(已锁定)
Creating, updating and deleting users with Sequelize12 分钟 52 秒
-
(已锁定)
Securing credentials with password hashing7 分钟 2 秒
-
(已锁定)
Implementing the user login9 分钟 15 秒
-
(已锁定)
-
-
-