Skip to content

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

Merged
samdark merged 5 commits intomasterfrom
copilot/improve-migrate-up-output
Mar 7, 2026

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 5, 2026

Three output quality issues across all migrate commands: a redundant >>> [OK] - '.Done..' message after history table creation, the >>> prefix on status lines, and Database connection: appearing at the bottom after results.

Changes

  • ConsoleMigrationInformer — removed endCreateHistoryTable() output entirely; the section header already communicates the action
  • UpdateRunner / 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)
  • All command execute() methods (migrate:up, migrate:down, migrate:redo, migrate:new, migrate:history, migrate:create) — moved databaseConnection() call to immediately after IO setup so it appears at the top of output; removed all scattered per-path calls
  • MigrationService::databaseConnection() — removed leading \n since the line now appears at the top
  • Inline writeln messages — removed >>> prefix from summary lines (Total N migrations applied/reverted, No new migrations found, etc.)
  • Tests — updated assertions to match new output format
  • ConsoleMigrationInformerTest — added unit tests covering all methods and code paths of ConsoleMigrationInformer to achieve 100% code coverage
Original prompt

This section details on the original issue you should resolve

<issue_title>Improve migrate:up output</issue_title>
<issue_description>### Proposed new feature or change

Image
  1. >>> [OK] - '.Done..'. is not useful at all and should be removed.
  2. >>> is looking weird. Could use unicode symbols or color instead.
  3. Database connection: x could be at the top of the output.</issue_description>

<agent_instructions>Apply the same to other commands as well. Don't forget to add CHANGELOG.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…sage, move DB connection to top

Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve migrate:up command output formatting Improve migrate command output: remove noise, clean up prefixes, move DB info to top Mar 5, 2026
Comment thread CHANGELOG.md Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 4.76190% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 12.81%. Comparing base (09e4caf) to head (f734b55).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/Command/DownCommand.php 0.00% 4 Missing ⚠️
src/Command/RedoCommand.php 0.00% 4 Missing ⚠️
src/Command/UpdateCommand.php 0.00% 4 Missing ⚠️
src/Runner/DownRunner.php 0.00% 2 Missing ⚠️
src/Runner/UpdateRunner.php 0.00% 2 Missing ⚠️
src/Command/CreateCommand.php 0.00% 1 Missing ⚠️
src/Command/HistoryCommand.php 0.00% 1 Missing ⚠️
src/Command/NewCommand.php 0.00% 1 Missing ⚠️
src/Service/MigrationService.php 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (09e4caf) and HEAD (f734b55). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (09e4caf) HEAD (f734b55)
6 1
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samdark
Copy link
Copy Markdown
Member

samdark commented Mar 6, 2026

@copilot increase code coverage to 100%.

Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 6, 2026

@copilot increase code coverage to 100%.

Added ConsoleMigrationInformerTest.php in commit f734b55 covering all methods of ConsoleMigrationInformer:

  • beginCreateHistoryTable both with and without IO (testing the nullsafe ?-> branch)
  • endCreateHistoryTable (empty method)
  • beginCommand with and without IO
  • endCommand with and without IO
  • setIo with null

@samdark samdark marked this pull request as ready for review March 7, 2026 08:18
Copilot AI review requested due to automatic review settings March 7, 2026 08:18
@samdark samdark changed the title Improve migrate command output: remove noise, clean up prefixes, move DB info to top 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 Mar 7, 2026
@samdark samdark merged commit d1b8c98 into master Mar 7, 2026
55 of 57 checks passed
@samdark samdark deleted the copilot/improve-migrate-up-output branch March 7, 2026 08:19
Copy link
Copy Markdown

Copilot AI left a 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 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 command execute() 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 {}
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
public function endCreateHistoryTable(string $message): void {}
public function endCreateHistoryTable(string $message): void
{
// Intentionally do nothing: console output for ending history table creation is suppressed.
}

Copilot uses AI. Check for mistakes.
Comment thread CHANGELOG.md
Comment on lines +9 to +11
- 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)
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CHANGELOG entry references "Enh #320", but the PR/issue context indicates this change is for #322. Please update the issue number in the changelog entry so it links to the correct ticket.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve migrate:up output

4 participants