diff options
author | schneems <richard.schneeman@gmail.com> | 2012-10-01 20:49:04 -0400 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2012-10-02 11:31:24 -0400 |
commit | eb853940d1aa5c92359b8d9fbc79142a03e9d238 (patch) | |
tree | 0966a6fb1439615b75f2ebafb4d2c606ba131d4a | |
parent | ddcda853c1aef19884a4e2153691389211aca3b2 (diff) | |
download | rails-eb853940d1aa5c92359b8d9fbc79142a03e9d238.tar.gz rails-eb853940d1aa5c92359b8d9fbc79142a03e9d238.tar.bz2 rails-eb853940d1aa5c92359b8d9fbc79142a03e9d238.zip |
instructions for running migrations in another ENV
-rw-r--r-- | guides/source/migrations.md | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/guides/source/migrations.md b/guides/source/migrations.md index ccbdffc9c7..2d633175d1 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -544,7 +544,7 @@ support](#active-record-and-referential-integrity). If the helpers provided by Active Record aren't enough you can use the `execute` method to execute arbitrary SQL. -For more details and examples of individual methods, check the API documentation. +For more details and examples of individual methods, check the API documentation. In particular the documentation for [`ActiveRecord::ConnectionAdapters::SchemaStatements`](http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html) (which provides the methods available in the `up` and `down` methods), @@ -700,6 +700,14 @@ will run the `up` method from the 20080906120000 migration. This task will first check whether the migration is already performed and will do nothing if Active Record believes that it has already been run. +### Running Migrations in Different Environments + +By default running `rake db:migrate` will run in the `development` environment. To run migrations against another environment you can specify it using the `RAILS_ENV` environment variable while running the command. For example to run migrations against the `test` environment you could run: + +```bash +$ rake db:migrate RAILS_ENV=test +``` + ### Changing the Output of Running Migrations By default migrations tell you exactly what they're doing and how long it took. |