Fix #320: Improve output of migrate:up, migrate:down, migrate:redo, migrate:new, migrate:history, and migrate:create commands: remove redundant messages, replace >>> with cleaner output, and move "Database connection" info to the top#328
Conversation
…sage, move DB connection to top Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #328 +/- ##
=============================================
- Coverage 99.68% 12.81% -86.87%
Complexity 293 293
=============================================
Files 20 20
Lines 952 944 -8
=============================================
- Hits 949 121 -828
- Misses 3 823 +820 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot increase code coverage to 100%. |
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Added
|
migrate:up, migrate:down, migrate:redo, migrate:new, migrate:history, and migrate:create commands: remove redundant messages, replace >>> with cleaner output, and move "Database connection" info to the top
There was a problem hiding this comment.
Pull request overview
This PR improves the console output consistency for migration CLI commands by removing redundant/noisy prefixes and ensuring the database connection info is printed at the top of command output.
Changes:
- Removed
>>>/-prefixes from per-migration status lines and various command summary lines. - Moved
MigrationService::databaseConnection()calls to the beginning of all relevant commandexecute()methods and removed the leading newline from the message itself. - Updated/added tests to match the new output format, including new coverage for
ConsoleMigrationInformer.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Informer/ConsoleMigrationInformer.php |
Suppresses history-table “done” output by making endCreateHistoryTable() a no-op. |
src/Runner/UpdateRunner.php |
Cleans per-migration “Applied / Not applied” status line prefixes. |
src/Runner/DownRunner.php |
Cleans per-migration “Reverted / Not reverted” status line prefixes. |
src/Service/MigrationService.php |
Removes leading newline from the “Database connection” line. |
src/Command/UpdateCommand.php |
Prints database connection info at the top; removes >>> from summary/status lines. |
src/Command/DownCommand.php |
Prints database connection info at the top; removes >>> from summary/status lines. |
src/Command/RedoCommand.php |
Prints database connection info at the top; removes >>> from summary/status lines. |
src/Command/NewCommand.php |
Prints database connection info at the top; removes bottom-printed DB info. |
src/Command/HistoryCommand.php |
Prints database connection info at the top; removes bottom-printed DB info. |
src/Command/CreateCommand.php |
Prints database connection info at the top; removes bottom-printed DB info. |
tests/Migration/ConsoleMigrationInformerTest.php |
Adds unit tests to cover ConsoleMigrationInformer code paths. |
tests/Common/Command/AbstractUpdateCommandTest.php |
Updates output assertions to match new formatting. |
tests/Common/Command/AbstractDownCommandTest.php |
Updates output assertions to match new formatting. |
tests/Common/Command/AbstractRedoCommandTest.php |
Updates output assertions to match new formatting. |
CHANGELOG.md |
Adds an entry describing the output improvements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| $this->io?->writeln("\t<fg=green>>>> [OK] - '.$message.'.</>"); | ||
| } | ||
| public function endCreateHistoryTable(string $message): void {} |
There was a problem hiding this comment.
endCreateHistoryTable() is now an empty one-liner, which makes the intent (no-op) unclear and is inconsistent with the explicit // do nothing style used in NullMigrationInformer. Consider expanding this to a normal method body and adding a short comment explaining that the output is intentionally suppressed.
| public function endCreateHistoryTable(string $message): void {} | |
| public function endCreateHistoryTable(string $message): void | |
| { | |
| // Intentionally do nothing: console output for ending history table creation is suppressed. | |
| } |
| - Enh #320: Improve output of `migrate:up`, `migrate:down`, `migrate:redo`, `migrate:new`, `migrate:history`, and | ||
| `migrate:create` commands: remove redundant messages, replace `>>>` with cleaner output, and move "Database | ||
| connection" info to the top (@samdark) |
There was a problem hiding this comment.
Three output quality issues across all migrate commands: a redundant
>>> [OK] - '.Done..'message after history table creation, the>>>prefix on status lines, andDatabase connection:appearing at the bottom after results.Changes
ConsoleMigrationInformer— removedendCreateHistoryTable()output entirely; the section header already communicates the actionUpdateRunner/DownRunner— stripped>>>and the-separator from per-migration status lines:>>> [OK] - Applied (time: 0.123s)→[OK] Applied (time: 0.123s)>>> [ERROR] - Not applied (time: 0.123s)→[ERROR] Not applied (time: 0.123s)execute()methods (migrate:up,migrate:down,migrate:redo,migrate:new,migrate:history,migrate:create) — moveddatabaseConnection()call to immediately after IO setup so it appears at the top of output; removed all scattered per-path callsMigrationService::databaseConnection()— removed leading\nsince the line now appears at the topwritelnmessages — removed>>>prefix from summary lines (Total N migrations applied/reverted,No new migrations found, etc.)ConsoleMigrationInformerTest— added unit tests covering all methods and code paths ofConsoleMigrationInformerto achieve 100% code coverageOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.