In development my bootstrap /start.php looked like
$env = $app->detectEnvironment(array(
'local' => array('homestead'),
));
after watching laracast segment on Environment i changed it to
$env = $app->detectEnvironment(function()
{
return getenv('ENV') ? : 'local';
});
On forge i have server installed and uploading from github. During development I used a different name than forge for my database. So when I set up the server on forge I used the same database name rather than using the default 'forge' name for database. However when i ssh into my server I can see the database with the same name as my development database but none of the tables are there. My save deploy script on forge is the default like so
cd /home/forge/default
git pull origin master
composer install
php artisan migrate --force
my config/database.php has the following
'default' => 'mysql',
....
connections' => array(
'sqlite' => array(
'driver' => 'sqlite',
'database' => __DIR__.'/../database/production.sqlite',
'prefix' => '',
),
'mysql' => array(
'driver' => 'mysql',
'host' => getenv('DB_HOST'),
'database' => getenv('DB_NAME'),
'username' => getenv('DB_USERNAME'),
'password' => getenv('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
I have also added above 4 environment variables on the server.
I also see them in the .env.php file on the server
What am I doing wrong? Why are my database migrations not on the server ?
Hope someone can help!
Thx
I see this on a previous request titled "I can't get Forge to work " answered by @Cocoon suggesting to put the following in start.php
As in the case of that request, my latest deployment log has
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO)
$env = $app->detectEnvironment(function () {
$environment = getenv('ENV');
if (strlen($environment) == 0) {
if (strpos(__DIR__, '/home/forge/dev.example.com') === 0) {
$environment = 'staging';
} elseif (strpos(__DIR__, '/home/forge/example.com') === 0) {
$environment = 'production';
}
}
if (strlen($environment) == 0) {
$environment = 'local';
}
return $environment;
});
But I don't get it. What's with example.com. Can someone explain