Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 8f35e252
authored
Apr 03, 2015
by
Pavel Karoukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add explanation of 'match' option for .sync() method.
1 parent
f5fc5010
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
docs/docs/models.md
docs/docs/models.md
View file @
8f35e25
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment