I have a Laravel installation and have set up three environments with their own corresponding config directories:
- local
- staging
- production
I use php artisan migrate:make create_users_table
etc as described here to create database migrations.
In my local environment I use Vagrant and a simple MySQL server setup, and on staging & production I use AWS RDS.
To configure database access for the staging environment I have a app/config/staging/database.php
file with settings like this:
...
"mysql" => array(
"driver" => "mysql",
"host" => $_SERVER["RDS_HOSTNAME"],
"database" => $_SERVER["RDS_DB_NAME"],
"username" => $_SERVER["RDS_USERNAME"],
"password" => $_SERVER["RDS_PASSWORD"],
"charset" => "utf8",
"collaction" => "utf8_unicode_ci",
"prefix" => "",
),
...
I use git to deploy the app with git aws.push
as described here.
The question is: How do I run the migration on my staging (and later production) EBS server when deploying?