-
Notifications
You must be signed in to change notification settings - Fork 95
Using Migrations for Deployment
The framework is configured to recognize development
, test
and production
environments out of the box. As such, migrations can be issued against any environment, whether its a local or remote server (assuming the network / remote server is configured to allow for connections from your current location).
Because migrations represent incremental changes, they are a great for deployment of your application. With just a single command line parameter, the migrations can be altered from running against the default development
database to production
instead.
By default a call to
php main.php db:migrate
will run against the development
database specified in config/database.inc.php
.
The ENV
command line parameter can be used to specify a different database to run against, as specific in the configuration file.
For example, to run against the production
database (as specified in config/database.inc.php
):
php main.php db:migrate ENV=production
You can add more deployment environments to the configuration file by following the existing syntax and then the ENV
variable will automatically use it.
To hook into the Capistrano "deploy:migrations" point, put this in your recipe:
desc "Run Ruckusing Migrations"
task :migrations, :role => :db do
run "cd #{latest_release}/path/to/ruckusing && php main.php db:migrate ENV=#{stage}"
end
The above assumes you're using the "staging" Capistrano facility so that the stage variable contains one of "development", "staging" or "production", etc.