不要怂,就是干,撸起袖子干!

Commit 6a84ba89 by Martin H. Bramwell Committed by Sushant

Amplify docs for "import" instruction (#7695)

* Amplify docs for "import" instruction

Signed-off-by: Martin H. Bramwell <martinhbramwell@gmail.com>

* Uses markdown correctly.  Grammar fixed.

Signed-off-by: Martin H. Bramwell <martinhbramwell@gmail.com>
1 parent 2934278c
Showing with 19 additions and 0 deletions
......@@ -581,6 +581,25 @@ sequelize.import('project', (sequelize, DataTypes) => {
})
```
This extra capability is useful when, for example, `Error: Cannot find module` is thrown even though `/path/to/models/project` seems to be correct. Some frameworks, such as Meteor, overload `require`, and spit out "surprise" results like :
```
Error: Cannot find module '/home/you/meteorApp/.meteor/local/build/programs/server/app/path/to/models/project.js'
```
This is solved by passing in Meteor's version of `require`. So, while this probably fails ...
```js
const AuthorModel = db.import('./path/to/models/project');
```
... this should succeed ...
```js
const AuthorModel = db.import('project', require('./path/to/models/project'));
```
## Optimistic Locking
Sequelize has built-in support for optimistic locking through a model instance version count.
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!