Comparing version 0.1.0 to 0.1.1
@@ -21,3 +21,3 @@ 'use strict'; | ||
// execution timeout | ||
timeout: 2000, | ||
timeout: 4000, | ||
// adapter path to require | ||
@@ -59,2 +59,14 @@ adapter: './adapter', | ||
Migrator.prototype.init = function(callback) { | ||
if (this.isDirExists()) throw Error( | ||
'Migration directory `' + this.params.dir + '` already exists' | ||
); | ||
fs.mkdirSync(this.params.dir); | ||
callback(); | ||
}; | ||
Migrator.prototype.isDirExists = function() { | ||
return fs.existsSync(this.params.dir); | ||
}; | ||
Migrator.prototype.create = function(basename, callback) { | ||
@@ -61,0 +73,0 @@ var self = this; |
{ | ||
"name": "east", | ||
"description": "node.js database migration tool", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Oleg Korobenko <oleg.korobenko@gmail.com>", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -6,2 +6,71 @@ # east | ||
work in progress... | ||
## Installation | ||
```sh | ||
npm install east -g | ||
``` | ||
alternatively you could install it locally | ||
## Usage | ||
go to project dir and run | ||
```sh | ||
east init | ||
``` | ||
after that you can `create`, `migrate`, `rollback` your migrations. | ||
Run `east -h` to see all commands: | ||
```sh | ||
Usage: east [options] [command] | ||
Commands: | ||
init initialize migration system | ||
create <basename> create new migration based on template | ||
migrate [options] [migrations] run all or selected migrations | ||
rollback [migrations] rollback all or selected migrations | ||
list [status] list migration with selected status (`new`, `executed` or `all`), `new` by default | ||
* | ||
Options: | ||
-h, --help output usage information | ||
-V, --version output the version number | ||
--adapter <name> which db adapter to use | ||
--config <path> config file to use | ||
--timeout <timeout> timeout for migrate/rollback | ||
--template <path> path to template for new migrations | ||
--dir <dir> dir where migrations stored | ||
--url <url> db connect url | ||
``` | ||
run `east <command> -h` to see detail command help. | ||
All options described above can be set via command line or at `.eastrc` file | ||
located at current directory, e.g.: | ||
```js | ||
{ | ||
"dir": "./dbmigration", | ||
"template": "./lib/node/utils/migrationTemplate.js" | ||
} | ||
``` | ||
## Running test | ||
into cloned repository run | ||
```sh | ||
npm test | ||
``` | ||
Sorry, the diff of this file is not supported yet
18905
333
76
8