jpswade/laravel-database-tools
Laravel Database Tools adds handy Artisan commands to create databases, dump/restore from SQL files or Spatie backups, update charset/collation, optimize MySQL tables, and add SQLite MySQL-compat functions for tests. Ideal for dev workflows.
OPTIMIZE TABLE or SQLite MySQL compatibility).--dev), avoiding production bloat. Complements existing Laravel services (e.g., Spatie Backup) without forcing tight coupling.dbtools.php, enabling customization for multi-database setups (e.g., staging/production parity) or non-standard storage backends.config/database.php) for db:dump/db:import, reducing context-switching.db:create, db:dump, db:import, db:optimize, etc., fitting Laravel’s CLI-first workflow.OPTIMIZE TABLE) may not translate perfectly to all SQLite use cases. Risk mitigated by clear documentation and optional usage.db:getFromBackup relies on Spatie Backup’s format. Incompatible backups (e.g., custom formats) could break workflows. Mitigation: Validate backup compatibility during CI/CD.db:dump in production).db:getFromBackup handle other formats?db:dump be automated in pipelines? If so, how will secrets (e.g., DB credentials) be managed?OPTIMIZE TABLE or large imports cause downtime? Are there rollback strategies?db:create in ephemeral environments (e.g., local dev containers).db:dump success/failure) via Laravel’s logging or external tools (Sentry, Datadog).db:dump/db:import.dbtools.php and customize paths (e.g., dbtools.filesystem.path to S3).db:dump if needed.mysqldump/pg_dump with db:dump in CI/CD.db:optimize in maintenance windows.db:getFromBackup into disaster recovery playbooks.db:getFromBackup assumes Spatie Backup’s zip format.pdo_mysql, pdo_pgsql, or pdo_sqlite. Verify extensions are enabled in php.ini.OPTIMIZE TABLE).composer require --dev jpswade/laravel-database-tools.php artisan vendor:publish --tag=dbtools-config.db:create in a throwaway database.db:dump produces valid SQL files (compare with mysqldump output).db:import and validate data integrity..env checks).allowed-artisan-commands in Laravel Forge/Envoyer if used.dbtools.php reduces risk of misconfigured commands across environments.composer.json until stability is confirmed.db:optimize --help).--verbose flags.storage/logs/laravel.log.php artisan db:import --dry-run).db:dump vs. Spatie Backup.db:dump may time out. Mitigation: Use --chunk or split tables.OPTIMIZE TABLE can lock tables. Mitigation: Schedule during low-traffic periods.ini_set('memory_limit', '512M').| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Corrupt backup file | Data loss on restore | Validate backups with db:getFromBackup --dry-run |
db:dump fails mid-execution |
Incomplete backup | Use transactional dumps or monitor job status |
| SQLite MySQL function missing | Query errors | Test compatibility early; document workarounds |
| Production use of dev-only commands | Data corruption/locks | Enforce environment checks in CI/CD |
| Filesystem permissions denied | Backup/restore failures | Use Laravel’s filesystem permissions helpers |
db:create in a sandbox.db:dump.mysqldump usage by 80% within 3 months.db:dump/db:import workflow.OPTIMIZE TABLE fail on PostgreSQL?").How can I help you explore Laravel packages today?