How to run migration on different environment in rails?
By default rails db:migrate
will run in the development
environment.
Let’s see how to run migrations on a different environment.
In order to run migrations on another environment we need to specify the
RAILS_ENV
environment variable.
For example:
RAILS_ENV=test rails db:migrate
The above command will run the db migrations against the test
environment.