Repository navigation
Fix #363: Add migrate:mark to move migration history to a version without executing migrations - #364
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Target resolution can reject valid names, select the wrong history range, or fail unnecessarily when migration sources are missing.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Adds migrate:mark to manage migration history without executing migrations, supporting adoption of existing databases described in #363.
Changes:
- Adds version selection, history reset, confirmation, and explicit database selection.
- Registers the command across supported integrations and documents its behavior.
- Adds shared driver tests and regression fixtures.
| File | Description |
|---|---|
| tests/Support/MarkMigrations/M260101000003Third.php | Guards against migration execution. |
| tests/Support/MarkMigrations/M260101000002Second.php | Provides a target fixture. |
| tests/Support/MarkMigrations/M260101000001First.php | Provides an earlier migration fixture. |
| tests/Migration/ConfigTest.php | Checks command resolution. |
| tests/Migration/BinTest.php | Checks standalone command availability. |
| tests/Driver/Sqlite/MarkCommandTest.php | Runs shared SQLite tests. |
| tests/Driver/Sqlite/DatabaseCommandsTest.php | Tests database isolation and history reset. |
| tests/Driver/Pgsql/MarkCommandTest.php | Runs shared PostgreSQL tests. |
| tests/Driver/Oracle/MarkCommandTest.php | Runs shared Oracle tests. |
| tests/Driver/Mysql/MarkCommandTest.php | Runs shared MySQL tests. |
| tests/Driver/Mssql/MarkCommandTest.php | Runs shared SQL Server tests. |
| tests/Common/Command/AbstractMarkCommandTest.php | Tests marking behavior and confirmation. |
| src/Migrator.php | Exposes history-only operations. |
| src/Command/MarkCommand.php | Implements the new command. |
| src/Command/DatabaseCommand.php | Requires database selection when needed. |
| src/Command/CommandFactory.php | Constructs the command. |
| README.md | Lists the new command. |
| docs/guide/en/usage-with-symfony.md | Documents Symfony registration. |
| docs/guide/en/README.md | Links the history guide. |
| docs/guide/en/multiple-databases.md | Documents database-specific marking. |
| docs/guide/en/migration-history.md | Explains marking behavior and risks. |
| config/params.php | Registers the console command. |
| config/di-console.php | Adds dependency-injection wiring. |
| CHANGELOG.md | Records the feature. |
| bin/yii-db-migration | Registers standalone usage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #364 +/- ##
============================================
+ Coverage 97.21% 97.38% +0.17%
- Complexity 347 375 +28
============================================
Files 25 26 +1
Lines 1114 1187 +73
============================================
+ Hits 1083 1156 +73
Misses 31 31 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Tigrov
reviewed
Oct 6, 2026
Tigrov
approved these changes
Oct 7, 2026
migrate:mark to move migration history to a version without executing migrations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Adds
migrate:mark <version>for databases where migration changes already exist. A pending target records migrations through that version; an applied target removes newer history entries. Neither operation runs migration methods.Supports full migration class names, migration timestamps, and
m000000_000000_baseto reset history. Includes confirmation,--force-yes, and explicit--dbselection when multiple databases are configured. Adds command registration, documentation, and regression tests. Includes a prominent guide warning and a shorter command-description warning about the risks of changing migration history.Fixes #363.