Sequelize
This document describes how to use Sequelize in Midway.
astuce
The current module has been reconfigured since v3.4.0, and the historical writing method is compatible. For more information about how to query historical documents, see here.
Related information:
Description | |
---|---|
Can be used for standard projects | ✅ |
Can be used for Serverless | ✅ |
Can be used for integration | ✅ |
Contains independent main framework | ❌ |
Contains independent logs | ❌ |
The difference with the old writing
If you want to use the new version of the usage, please refer to the following process to modify the old code. The new and old codes cannot be mixed.
Upgrade method:
-
- Please explicitly add
sequelize
andsequelize-typescript
to the business dependency
- Please explicitly add
-
- Instead of using the
BaseTable
decorator, use theTable
decorator exported by thesequelize-typescript
package directly.
- Instead of using the
-
- configure the adjustment in the
sequelize
section ofsrc/config.default
. refer to the following data source configuration section
- The 3.1 is modified to the form of a data source to
sequelize.dataSource
- 3.2 declare the entity model in the
entities
field of the data source
- configure the adjustment in the