What problem does it solve?
This skill helps Laravel teams remove database-level foreign key constraints and unique constraints, replacing them with application-level enforcement to keep business rules in code rather than in the database.
Core Features & Use Cases
- Remove all database-level foreign keys and constraints declared in migrations, including ->foreign(), ->constrained(), and FOREIGN KEY references.
- Remove database-level unique constraints and unique indexes, with guidance to replace with model-level checks and appropriate plain indexes when beneficial.
- Implement plan-file and migration-based workflows: edit plan files directly for planned changes and create drop migrations for already-run constraints; add boot() checks or Rule classes to enforce rules in the application.
- Add boot() checks in relevant Eloquent models for creation and updating to enforce uniqueness, using exists() to ensure no duplicates, and excluding the current model on updates.
- Optional dedicated Rule classes for complex constraints to be reused.
Quick Start
Identify migrations and plan files with constraints, then apply drop migrations or plan edits and add boot() checks in the relevant models.