Skip to content

Not able to run laravel migrations in the release build on build server #2745

Answered by lexjwa
lexjwa asked this question in Help needed
Discussion options

You must be logged in to vote

Thank you all for pointing to possible fix.

To load the multiple hosts from the database we are using vlucas/phpdotenv to connect to database and for some reason deployer was keeping database connection from project we have installed it in.

I am able to resolve the issue using createMutable instead of createImmutable method. Since we are interacting with multiple databases from the deploy.php we have to initiate the database connection each time we connect to a different database.

We can pass the .env file like this and overwrite existing environment variables.

$dotenv = Dotenv::createMutable(__DIR__, '.env');
$dotenv->safeLoad();
$dotenv->required(['DB_CONNECTION', 'DB_HOST', 'DB_PORT', …

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@antonmedv
Comment options

@nathan-io
Comment options

@lorisleiva
Comment options

@nathan-io
Comment options

@antonmedv
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by lexjwa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants