cycle/migrations
Cycle Database Migrations provides structured, versioned database schema changes for Cycle ORM/DBAL. Configure a migrations directory and table, run pending migrations programmatically, and optionally include vendor migrations or generate migration files during schema compilation.
cycle/migrations package (v4.2.6) continues to align with Laravel’s Eloquent ORM and database-first workflows, particularly for teams managing frequent schema changes. The new release introduces a non-breaking change that improves handling of after/first attributes in foreign key constraints, reducing edge-case failures.after/first attributes, which previously caused unnecessary migration clutter.Schema builder and Migrations facade.after/first attributes reduces manual overrides for default foreign key ordering, but custom logic (e.g., non-standard constraints) still requires configuration.| Risk Area | Severity | Mitigation Strategy | Update for v4.2.6 |
|---|---|---|---|
| Schema Inference Errors | Medium | Validate against staging DB snapshots. | Reduced: Fix for after/first attributes minimizes false positives. |
| Migration Conflicts | High | Enforce branch-specific prefixes. | Unchanged. |
| Performance Overhead | Low | Benchmark for large schemas (>100 tables). | Unchanged. |
| Testing Gaps | Medium | Add unit tests for critical migrations. | New: Test foreign key after/first logic in CI. |
| License Compliance | Low | MIT license remains permissive. | Unchanged. |
| Foreign Key Edge Cases | Low | Monitor for regressions in cascading constraints. | New Risk: Validate if other after/first edge cases exist (e.g., composite keys). |
after/first with custom logic) beyond default values? If yes, test thoroughly.after/first rollbacks correctly? Test with destructive changes involving foreign keys.after/first attributes are generated as expected for critical tables.after/first attributes makes it safer for teams relying on auto-generated migrations for production.orders → users, products → categories).after/first constraints.DROP TABLE with cascading deletes).after/first attributes in auto-generated migrations.- name: Validate migrations
run: php artisan cycle:diff --strict && php artisan migrate:fresh --env=testing
after logic still requires manual overrides).| Component | Compatibility Notes | Update for v4.2.6 |
|---|---|---|
| Laravel Version | Tested with Laravel 10.x; 11.x may need checks for Schema API changes. |
Unchanged. |
| Database Drivers | Supports MySQL, PostgreSQL, SQLite. | New: Test PostgreSQL composite keys with after/first. |
| Custom Migrations | Conflicts if using non-standard Migration classes. |
Unchanged. |
| Third-Party Packages | May interfere with packages like Spatie’s Laravel Migrations. | Unchanged. |
| Foreign Key Logic | Improved: Default after/first handling is now ignored, reducing noise. |
Critical: Test with MySQL 8.0+ (strict mode) and PostgreSQL 15+. |
after/first usage—these may now be auto-generated incorrectly if not default values.mysqldump --no-data --routines=false.php artisan cycle:migrate --tables=orders,products --output=database/migrations --verbose
--verbose to log after/first attribute handling.after/first for default cases (document in PR templates).after/first attributes are now ignored, making diffs cleaner.after/first cases are handled, leading to undetected edge cases.// WARNING: This migration was auto-generated. Custom `after`/`first` logic may not be preserved.
after attribute ignored?" → "Only default values are auto-handled."after is wrong" → Verify custom logic (non-default values still require manual edits).ON CONFLICT).php artisan cycle:inspect --table=orders to visualize FK relationships.How can I help you explore Laravel packages today?