scheduler:run or queue:work).WHERE clauses, TTL).Schema::create or Model::archive()).Schema::create for archive tables.Model::archive() or query-based archiving.db-archive:run for manual triggers.Archived/ArchiveFailed) for custom logic.user_sessions) to test archiving logic.EXPLAIN ANALYZE before/after).orders → orders_archive).LEFT JOIN orders_archive ON ...).JSON/UUID columns if used).archived_at column to primary tables (if not present).config/db-archive.php (e.g., TTL, batch size).php artisan db-archive:run --table=users --batch=1000 for backfill.@daily for logs, @monthly for orders).config/).archive_jobs).DB::enableQueryLog() to inspect SQL during backfill.$table->disableForeignKeyConstraints()).chunk().orders_archive_2023, orders_archive_2024).batch_size in config for faster backfills (tradeoff: memory usage).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Archiving job crashes | Partial data archived | Use transactions or idempotent batch processing. |
| Database connection drops | Job retries (if using queues) | Implement exponential backoff. |
| Schema mismatch | Archive table creation fails | Validate schema pre-deployment. |
| Query performance degradation | Joins to archive tables slow down | Add indexes to frequently queried columns. |
| Retention policy misconfig | Data archived too early/late | Test with WHERE clauses in staging. |
How can I help you explore Laravel packages today?