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

Commit f859e2e7 by Mick Hansen

Merge pull request #3853 from cpitt/master

removed references to getMigrator()
2 parents 720d4d88 a04ee7d6
Showing with 1 additions and 22 deletions
......@@ -273,25 +273,8 @@ migration.removeIndex('Person', ['firstname', 'lastname'])
```
## Programmatic use
Sequelize has a [sister library](https://github.com/sequelize/umzug) for programmatically handling execution and logging of migration tasks.
If you need to interact with the migrator within your code, you can easily achieve that via `sequelize.getMigrator`. You can specify the path to your migrations as well as a pattern which represents the files that contain the migrations.
```js
var migrator = sequelize.getMigrator({
path: process.cwd() + '/database/migrations',
filesFilter: /\.coffee$/
})
```
Once you have a migrator object, you can run its migration with `migrator.migrate`. By default, this will execute all the up methods within your pending migrations. If you want to rollback a migration, just call it like this:
```js
migrator
.migrate({ method: 'down' })
.then(function() {
// The migrations have been executed!
})
```
[0]: http://gulpjs.com/
[1]: https://github.com/sequelize/cli
......
......@@ -603,10 +603,6 @@ Sequelize.prototype.import = function(path) {
return this.importCache[path];
};
Sequelize.prototype.migrate = function(options) {
return this.getMigrator().migrate(options);
};
/**
* Execute a query on the DB, with the posibility to bypass all the sequelize goodness.
*
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!