You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Details
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.
Migrating via Capistrano
To hook into the Capistrano "deploy:migrations" point, put this in your recipe:
The above assumes you're using the "staging" Capistrano facility so that the stage variable contains one of "development", "staging" or "production", etc.