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

Commit 484613a7 by Mick Hansen

Merge pull request #3457 from hippich/docs/pk-add-sync-match-option-description

Add explanation of 'match' option for .sync() method.
2 parents f5fc5010 8f35e252
Showing with 9 additions and 0 deletions
......@@ -485,6 +485,15 @@ sequelize.[sync|drop]().then(function() {
})
```
Because `.sync({ force: true })` is destructive operation, you can use `match` option as an additional safety check.
`match` option tells sequelize to match a regex against the database name before syncing - a safety check for cases
where `force: true` is used in tests but not live code.
```js
// This will run .sync() only if database name ends with '_test'
sequelize.sync({ force: true, match: /_test$/ });
```
## Expansion of models
Sequelize allows you to pass custom methods to a model and its instances. Just do the following:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!