Comparing version 0.2.4 to 0.2.5
@@ -42,3 +42,3 @@ 'use strict'; | ||
var defaultConfigPath = path.resolve('.eastrc'); | ||
configPath = fs.existsSync(defaultConfigPath) ? defaultConfigPath : ''; | ||
configPath = fs.existsSync(defaultConfigPath) ? defaultConfigPath : ''; | ||
} | ||
@@ -314,6 +314,22 @@ if (!configPath) return {}; | ||
migration[action], function(err) { | ||
if (err) {callback(err); return; } | ||
self.adapter[action == 'migrate' ? 'markExecuted' : 'unmarkExecuted']( | ||
migration.name, callback | ||
); | ||
if (err) { callback(err); return; } | ||
if (migration.force) { | ||
self.adapter.getExecutedMigrationNames(function(err, executedNames) { | ||
if (err) { callback(err); return; } | ||
var isExecuted = executedNames.indexOf(migration.name) != -1; | ||
if (action == 'migrate' && !isExecuted) { | ||
self.adapter.markExecuted(migration.name, callback); | ||
} else if (action == 'rollback' && isExecuted) { | ||
self.adapter.unmarkExecuted(migration.name, callback); | ||
} else { | ||
callback(); | ||
} | ||
}); | ||
} else { | ||
self.adapter[action == 'migrate' ? 'markExecuted' : 'unmarkExecuted']( | ||
migration.name, callback | ||
); | ||
} | ||
} | ||
@@ -320,0 +336,0 @@ ); |
{ | ||
"name": "east", | ||
"description": "node.js database migration tool for mongodb, sqlite, postgres, mysql", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"author": "Oleg Korobenko <oleg.korobenko@gmail.com>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -245,9 +245,11 @@ # east | ||
For writing your own adapter you should implement methods for connection, | ||
mark transaction as executed, etc see details inside [built-in adapter](lib/adapter) | ||
mark transaction as executed, etc see details inside [built-in adapter](lib/adapter.js) | ||
and [other adapters](#adapters). | ||
You also can run tests from current repository against your adapter: | ||
1. Clone current repository | ||
2. Create file `.eastrc` inside `test` directory with path and parameters for | ||
* Clone current repository | ||
* Create file `.eastrc` inside `test` directory with path and parameters for | ||
your adapter e.g. | ||
```js | ||
@@ -260,7 +262,8 @@ { | ||
``` | ||
3. Run `npm test` at root of the cloned repository. | ||
* Run `npm test` at root of the cloned repository. | ||
## License | ||
MIT |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30645
496
268