1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

instructions for running migrations in another ENV

This commit is contained in:
schneems 2012-10-01 20:49:04 -04:00
parent ddcda853c1
commit eb853940d1

View file

@ -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.