课程: Databases for Node.js Developers (2021)
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Create sequelize models
- [Instructor] We will now define the models for our sequelize in our shopper application. And spoiler alert, these models will then also be used to automatically create the tables and relationships in the database. So let's head to server, models and in models, I will now create a new directory sequelize. And in sequelize, I create a file index.js. So we could now go ahead and also create one dedicated file per database table like we did for mongoose, but with sequelize that's rather complicated as order and order item will always be used together, I decided to just leave them in one file. So we can just go ahead now and add const, and then we want to bring in the data types that sequelize provides, so in curly brackets I now add DataTypes equals require sequelize. So this will now basically fetch the property data types from sequelize. Then I start with module.export, so this is what we actually want to export. And we…
内容
-
-
-
-
-
-
-
(已锁定)
When to use relational databases59 秒
-
(已锁定)
Set up MySQL3 分钟 20 秒
-
(已锁定)
Create a database schema4 分钟 17 秒
-
(已锁定)
Use Node.js with MySQL9 分钟 58 秒
-
(已锁定)
Introduction to Sequelize2 分钟 4 秒
-
(已锁定)
Add MySQL and Sequelize to your project6 分钟 28 秒
-
(已锁定)
Review the database design2 分钟
-
(已锁定)
Create sequelize models8 分钟 51 秒
-
(已锁定)
Review the auto-generated database structure2 分钟 20 秒
-
(已锁定)
Implement an order service8 分钟 29 秒
-
(已锁定)
Add order management7 分钟 13 秒
-
(已锁定)
-