Overview
Database dumps are sanitized backups of specific table groups, designed for:- Seeding - Populating new environments with data
- Development - Syncing local databases with production
- Backup - Creating point-in-time snapshots
- Distribution - Sharing curated datasets publicly
Dump model.
Dump Types
AnimeThemes Server organizes dumps by functional domain:Wiki Dump
Contains wiki-related tables for anime themes content:- Anime entries
- Artists and groups
- Songs and performances
- Themes and theme entries
- Videos and audio
- Images and resources
- Studios and series
- Synonyms
php artisan db:dump-wiki
User Dump
Contains user-related tables:- User accounts
- User profiles
- Playlists
- External profiles
php artisan db:dump-user
Auth Dump
Contains authentication and authorization tables:- Roles
- Permissions
- Role-permission mappings
- User-role assignments
php artisan db:dump-auth
Admin Dump
Contains administrative tables:- Featured themes
- Features (feature flags)
- Announcements
- Action logs
php artisan db:dump-admin
List Dump
Contains playlist and list-related tables:- Playlists
- Playlist tracks
- External profiles
- External entries
php artisan db:dump-list
Document Dump
Contains documentation and content page tables:- Pages
- Page content
php artisan db:dump-document
Discord Dump
Contains Discord integration tables:- Discord threads
- Discord messages
php artisan db:dump-discord
Creating Dumps
Basic Usage
The simplest way to create a dump:Recommended Production Settings
For production dumps, use these recommended options:--default-character-set=utf8- Ensures consistent character encoding--single-transaction=true- Creates a consistent snapshot without locking tables--skip-column-statistics- Reduces dump size and speeds up creation--extended-insert- Reduces dump size with multi-row inserts
MySQL vs PostgreSQL Options
The dump commands support both MySQL and PostgreSQL with database-specific options.MySQL-Specific Options
PostgreSQL-Specific Options
Dump Storage
Dumps are stored in object storage configured byDumpConstants::DISK_QUALIFIED (typically S3 or compatible).
Storage Structure
Database Tracking
Each dump is tracked in thedumps table with:
id- Unique identifierpath- Storage path to the dump filepublic- Whether the dump is publicly accessiblecreated_at- When the dump was createdupdated_at- Last modification time
Restoring Dumps
Local Development Sync
The easiest way to restore dumps in development:- Drops and recreates the database (if
--dropis used) - Truncates wiki tables
- Downloads the latest wiki dump from
https://dump.animethemes.moe/latest/wiki - Imports the dump into the database
- Runs migrations
- Seeds permissions, roles, and features
- Imports models for Scout search
Manual Restore
To manually restore a dump:Partial Restore
To restore only specific tables, use the dump file with table filtering:Managing Dumps
Viewing Dumps
Use the admin panel to view all dumps:- Navigate to Admin > Dumps
- View dump path, public status, and timestamps
- Search dumps by path
Pruning Old Dumps
Automatically remove old dump files:- Deletes dump files from object storage
- Removes corresponding database records
- Logs all deletions
Reconciling Dumps
Ensure database records match storage files:- Compares dumps in database vs. storage
- Identifies orphaned records (no file)
- Identifies orphaned files (no record)
- Reports inconsistencies
- Creating dumps
- Manually deleting files
- Storage migrations
- Database restores
Dump Formats
SQL Format
Default format for dumps. Contains:Compressed Dumps
While not implemented by default, you can compress dumps:Public Dumps
Some dumps can be marked as public for distribution.Making Dumps Public
Set thepublic flag on dump records to make them accessible without authentication. Public dumps are served from:
Public Dump Use Cases
- Development: Allow developers to sync with production data
- Community: Share datasets with the community
- Mirrors: Enable third parties to create mirrors
- Research: Provide data for analysis
Admin Panel Actions
The Dumps resource in the admin panel provides several actions:Dump Wiki
Create a new wiki dump directly from the admin panel.- Navigate to Admin > Dumps
- Click the actions menu
- Select Dump Wiki
- Dump is created in the background
Dump Document
Create a document dump from the admin panel.Prune Dump
Remove old dumps using the configured retention period.Reconcile Dump
Trigger reconciliation between database and storage.Best Practices
Dump Creation
- Use transactions: Always use
--single-transaction=truefor consistent snapshots - Skip statistics: Use
--skip-column-statisticsto reduce size - Character set: Always specify
--default-character-set=utf8 - Extended inserts: Use
--extended-insertfor smaller files - Schedule dumps: Run dump commands on a schedule for regular backups
Dump Management
- Regular pruning: Schedule
prune:dumpto run daily - Monitor storage: Watch storage usage for dump files
- Reconcile regularly: Run
reconcile:dumpafter bulk operations - Verify imports: Always verify dumps after creation
- Test restores: Regularly test dump restoration in development
Security
- Sanitize data: Ensure dumps don’t contain sensitive information
- Control access: Only make appropriate dumps public
- Encryption: Consider encrypting dumps at rest
- Audit: Monitor dump access and downloads
- Retention: Don’t retain dumps longer than necessary
Automation
Scheduled Dump Creation
CI/CD Integration
Troubleshooting
Dump Creation Fails
Problem: Dump command fails with error Solutions:- Check database credentials
- Verify storage disk configuration
- Ensure sufficient disk space
- Check database server is accessible
- Review error logs
Import Fails
Problem: Cannot import dump into database Solutions:- Verify SQL syntax compatibility
- Check character set matches
- Ensure database exists
- Verify user permissions
- Check for table name conflicts
Storage Inconsistencies
Problem: Reconciliation reports mismatches Solutions:- Run
reconcile:dumpto identify issues - Manually verify files in storage
- Check database records
- Remove orphaned records
- Re-create missing dumps
Slow Dump Creation
Problem: Dumps take too long to create Solutions:- Use
--quickfor large tables - Use
--single-transaction=trueto avoid locks - Schedule dumps during off-peak hours
- Consider table-specific dumps
- Optimize database indexes