Skip to content

feat(migrations): enable recursive discovery in subdirectories#321

Merged
usernane merged 1 commit into
devfrom
feat/recursive-migration-discovery
May 10, 2026
Merged

feat(migrations): enable recursive discovery in subdirectories#321
usernane merged 1 commit into
devfrom
feat/recursive-migration-discovery

Conversation

@usernane
Copy link
Copy Markdown
Member

Summary

Enable recursive discovery of migrations and seeders in subdirectories for all CLI migration commands.

Motivation

Organizing migrations by domain in subdirectories (e.g. Database/Migrations/Master/, Database/Migrations/Lms/) is silently ignored because discoverFromPath() is called without $recursive = true. Fixes #317.

Changes

  • Pass true for the $recursive parameter in discoverFromPath() calls across all 5 migration commands:
    • RunMigrationsCommandNew
    • FreshMigrationsCommand
    • RollbackMigrationsCommand
    • DryRunMigrationsCommand
    • MigrationsStatusCommand
  • Move legacy broken test fixtures (MultiErr, EmptyRunner, NoConn) from App/Database/Migrations/ to tests/fixtures/Database/Migrations/
  • Add RecursiveMigrationDiscoveryTest with 9 test cases covering all commands

How to Test / Verify

Unit tests: run phpunit --testsuite "CLI Tests" --filter RecursiveMigrationDiscoveryTest

All 9 tests verify that migrations/seeders placed in subdirectories are discovered and executed correctly.

Breaking Changes and Migration Steps

None. Existing top-level migrations continue to work. Subdirectories that were previously ignored will now be scanned.

Checklist

  • I reviewed my own diff before requesting review
  • My commits follow Conventional Commits
  • The title of the pull request follows Conventional Commits
  • I added/updated tests (or explained why not)
  • I updated docs (if needed)
  • I ran lint/cs-fixer (if applicable)
  • I considered backward compatibility
  • I considered security

Related issues

Closes #317

…ctories

Pass `true` for the `$recursive` parameter in all CLI migration
commands so that migrations and seeders organized in subdirectories
are automatically discovered.

Affected commands:
- migrations:run
- migrations:fresh
- migrations:rollback
- migrations:dry-run
- migrations:status

Also moves legacy broken test fixtures out of App/Database/Migrations
into tests/fixtures/ to prevent them from being picked up by recursive
discovery.

Closes #317
@usernane usernane force-pushed the feat/recursive-migration-discovery branch from 2e97d67 to b855c18 Compare May 10, 2026 21:04
@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

❌ Patch coverage is 84.24242% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.88%. Comparing base (f71d6c1) to head (b855c18).

Files with missing lines Patch % Lines
...Framework/Cli/Commands/DryRunMigrationsCommand.php 79.62% 11 Missing ⚠️
...amework/Cli/Commands/RollbackMigrationsCommand.php 83.33% 9 Missing ⚠️
...Framework/Cli/Commands/MigrationsStatusCommand.php 88.67% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #321      +/-   ##
============================================
+ Coverage     74.81%   74.88%   +0.06%     
+ Complexity     3005     2986      -19     
============================================
  Files            97       97              
  Lines          9565     9551      -14     
============================================
- Hits           7156     7152       -4     
+ Misses         2409     2399      -10     
Flag Coverage Δ
php-8.1 ?
php-8.2 ?
php-8.3 74.88% <84.24%> (ø)
php-8.4 ?
php-8.5 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@usernane usernane merged commit 65a916b into dev May 10, 2026
4 checks passed
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.

1 participant