Browse files

Updated readme with new command-line options

  • Loading branch information...
1 parent ded378e commit 634972cb0b2bab046225471d0f99e11e15a3c283 @emerleite committed Jan 6, 2012
Showing with 23 additions and 9 deletions.
  1. +23 −9
@@ -14,10 +14,6 @@ Instalation
Edit *config.cfg* with your database information
-Mongo migrate has two options. `generate` and `run`. The syntax is pretty straitforward as explained above:
### Basic information
By convention, mongo migrate uses the directory db/migrate when generating and running migrations. You can change it, by editing the MIGRATION_DIR configuration at config.cfg. See config.sample.cfg for details.
@@ -32,12 +28,16 @@ MongoDB migrate uses a configuration file called config.cfg. It has the followin
Note: When you use MONGO_USR and not MONGO_PWD you'll be prompted for password.
+Mongo migrate has two modes. `generate` and `run`. The syntax is pretty straitforward as explained above:
### Generate
Mongo migrate generates migrtion in the following format:
YYYMMDDhhmmssmm_name.js. Ex: 20111209002426_add_person.js
- $ ./mongo_migrate generate [name]
+ $ ./mongo_migrate -gf [migration_name]
This will generate the following file:
@@ -59,15 +59,29 @@ Put the code for the changes on up and the code for rollback on down.
### Running
Mongo migrate has 2 modes of running. Up and Down. The first make things happen and the second is a rollback. For these 2 modes, we call run one specific migration or all migrations. Mongo migrate controll the current migration, to enable run only the last migrations or just run all.
+### Options
+-g generate
+-r run
+-t target (up|down)
+-f file_name
+-c configuration file
### One migration
- $ ./mongo_migrate run [name] up
- $ ./mongo_migrate run [name] down
+ $ ./mongo_migrate -rt up -f [file_name]
+ $ ./mongo_migrate -rt down -f [file_name]
The name can bem the full name or partial name. Ex: 20111209002426_add_person.js or only add_person. Mongo migrate will first look for a full name and after will fallback to find the file based on the partial name.
### All migrations
- $ ./mongo_migrate run up
- $ ./mongo_migrate run down
+ $ ./mongo_migrate -rt up
+ $ ./mongo_migrate -rt down
+### Configuration file
+If you want to pass the configuration file path and not use the convention (i.e ./config.cfg), just use the -c option parameter:
+ $ ./mongo_migrate -rt up -f migration_file -c /path/to/config/file
+ $ ./mongo_migrate -rt down -c /path/to/config/file
+ $ ./mongo_migrate -gf migration_name -c /path/to/config/file
When running all migrations, mongo migrate will run only the new migrations, because it controls witch is the last one.

0 comments on commit 634972c

Please sign in to comment.