laranail/db-tools
Laranail DB Tools bundles practical database utilities for Laravel, offering convenient Artisan commands and helpers to inspect schemas, manage connections, and handle routine maintenance. A handy toolkit for debugging queries and keeping your database layer tidy.
createSchemaMacro) may require global namespace awareness if used across multiple packages.HasUlid/HasUuid traits. Feasible but requires migration planning (indexing, foreign keys).createSchemaMacro('softArchive', fn() => ...)). Highly flexible but demands testing for edge cases (e.g., raw SQL conflicts).SoftDeletes if not namespaced.JsonCast, EncryptedCast) reduce boilerplate but require validation for serialization/deserialization edge cases.db_tools::softArchive).use \Laranail\DbTools\Traits\HasUlid;.BigIncrements() with Ulid().Schema::macro('softArchive', fn() => Schema::table(...));
SoftDeletes with SoftArchivable where needed.whereNull('archived_at')).artisan db:backup.model()->getKey()).DB::raw(), Schema::table(), and Model::increment() usages that may conflict with macros.deleted_at checks with archived_at if using soft-archive.| Step | Priority | Dependencies | Risk Mitigation |
|---|---|---|---|
| UUID/ULID Setup | High | Model refactoring | Backward-compatible FKs |
| Schema Macros | Medium | Migration testing | Isolate in a feature branch |
| Soft-Archive | Medium | Query updates | Feature flag for gradual rollout |
| Backup/Restore | Low | DevOps approval | Pilot with non-prod DB |
| Component | Failure Scenario | Impact | Recovery Plan |
|---|---|---|---|
| UUID/ULID | Migration fails (FK constraints) | Data loss | Rollback to auto-increment |
| Schema Macros | Macro conflicts with other packages | Broken migrations | Rename macros (e.g., db_tools_) |
| Soft-Archive | Query omits archived records unintentionally | Data visibility gaps | Add withArchived() scope |
| Backup/Restore | Backup corrupts or excludes tables | Incomplete restore | Validate backups via checksums |
| Casts | Serialization fails (e.g., JSON cast) | Data corruption | Add fallback serialization |
How can I help you explore Laravel packages today?