Skip to content

Add migrations reset command#994

Merged
dereuromark merged 5 commits into4.xfrom
fix-test-deprecations
Jan 13, 2026
Merged

Add migrations reset command#994
dereuromark merged 5 commits into4.xfrom
fix-test-deprecations

Conversation

@dereuromark
Copy link
Copy Markdown
Member

@dereuromark dereuromark commented Jan 11, 2026

Summary

Implements the migrations reset command as requested in #972.

This is a "nuclear option" that:

  • Drops all tables in the database (including tracking tables like cake_migrations, phinxlog)
  • Re-runs all migrations from scratch

Features

  • Interactive Y/N confirmation (defaults to N) before dropping tables
  • --dry-run flag to preview what would be dropped
  • --no-lock flag to skip lock file generation
  • Supports --plugin, --connection, and --source options
  • Dispatches Migration.beforeReset and Migration.afterReset events
  • Handles foreign key constraints across MySQL, PostgreSQL, SQLite, and SQL Server

Usage

migrations reset              # Reset default connection
migrations reset -c test      # Reset test connection  
migrations reset --dry-run    # Preview without changes
migrations reset --no-lock    # Skip lock file generation

Closes #972

- Fix EntryCommandTest assertion for changed help output format
- Fix ManagerFactoryTest dynamic property deprecations (PHP 8.4)
- Add missing plugin classes for Blog and Migrator test plugins
- Add proper assertions to PendingMigrationsMiddlewareTest risky tests
@dereuromark dereuromark marked this pull request as draft January 11, 2026 08:14
@dereuromark
Copy link
Copy Markdown
Member Author

Maybe we skip those and instead release the new major. The if/else switches to have all tests green seem heavy.

@jamisonbryant
Copy link
Copy Markdown
Contributor

The test results are confusing! It was originally failing looking for <info>migrations:</info> and so I fixed it, but now a bunch of test are failing looking for <info>migrations</info>:!

Remove the assertion for 'migrations:</info>' as the help output
format differs between PHP versions. The remaining assertions
adequately verify the help output is displayed correctly.
The identity column syntax varies between CakePHP/database versions
(SERIAL vs GENERATED BY DEFAULT AS IDENTITY). Update the tests to
check for the key parts of the CREATE TABLE statement without being
strict about the identity column syntax.
@dereuromark dereuromark marked this pull request as ready for review January 13, 2026 03:24
@dereuromark dereuromark merged commit 7dbc620 into 4.x Jan 13, 2026
13 checks passed
@dereuromark dereuromark deleted the fix-test-deprecations branch January 13, 2026 03:24
@dereuromark dereuromark changed the title Fix test deprecations and failures Add migrations reset command Mar 12, 2026
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.

3 participants