no-db-constraints
CommunityRemove DB constraints; enforce rules in Laravel apps.
Authoronairmarc
Version1.0.0
Installs0
System Documentation
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.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: no-db-constraints Download link: https://github.com/onairmarc/dotfiles/archive/main.zip#no-db-constraints Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.