-
Couldn't load subscription status.
- Fork 0
fix: update DB env vars during initialization #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pull Request Test Coverage Report for Build 18334096819Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes database environment variable configuration during the initialization process by replacing direct Artisan calls with shell_exec commands to ensure proper environment setup for migrations.
- Replaces
Artisan::call('migrate')with a newrunMigrations()method that configures database environment variables before running migrations via shell_exec - Changes
Artisan::call('vendor:publish')toshell_execin thepublishWebLogin()method for consistency - Updates test expectations to include the new shell_exec calls and removes the
assertWebLoginPublished()method calls from test assertions
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Commands/InitCommand.php | Adds database configuration setup in new runMigrations() method and switches to shell_exec for vendor:publish command |
| tests/InitCommandTest.php | Updates test expectations to match new shell_exec approach and removes web login assertions |
| tests/TestCase.php | Removes unused assertFileEqualsFixture() method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/Commands/InitCommand.php
Outdated
| ]); | ||
| } | ||
|
|
||
| shell_exec("php artisan migrate"); |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using shell_exec without error handling could mask migration failures. Consider checking the return value or using a more robust command execution method that can capture and handle errors.
| shell_exec("php artisan migrate"); | |
| $output = []; | |
| $exitCode = 0; | |
| exec("php artisan migrate", $output, $exitCode); | |
| if ($exitCode !== 0) { | |
| $this->error("Migration failed with exit code {$exitCode}.\nOutput:\n" . implode("\n", $output)); | |
| throw new \RuntimeException("Migration failed. See error output above."); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@artengin I not sure, could you please check it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method works,
but the shell command also outputs error messages from the migrations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Commands/InitCommand.php
Outdated
| ]); | ||
| } | ||
|
|
||
| shell_exec("php artisan migrate"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@artengin I not sure, could you please check it?
|
The following errors: PHP Fatal error: Declaration of Monolog\Logger::emergency(Stringable|string $message, array $context = []): void must be compatible with Psr\Log\LoggerInterface::emergency($message, array $context = []) in /var/www/test/test-laravel/vendor/monolog/monolog/src/Monolog/Logger.php on line 683
PHP Fatal error: Uncaught Error: Class "Monolog\Logger" not found in /var/www/test/test-laravel/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php:60did not occur because of our package, but due to an internal issue in Laravel. Reference to the related issue in laravel/framefork #57295 As a result,, using |









Refs: #42