Database Commands
Database Dump Commands
The server provides specialized dump commands for creating sanitized database backups targeting specific table groups.db:dump-wiki
Produces a sanitized database dump targeting wiki-related tables for seeding purposes.--comments- Write additional information in the MySQL dump (program version, server version, host)--data-only- Dump only data without schema (PostgreSQL)--default-character-set=utf8- Specify default character set (default: utf8)--extended-insert- Use multiple-row INSERT syntax (MySQL)--inserts- Dump data as INSERT commands rather than COPY (PostgreSQL)--lock-tables- Lock all tables before dumping--no-create-info- Turn off CREATE TABLE statements (MySQL)--quick- Retrieve rows one at a time (MySQL)--set-gtid-purged=AUTO- Add SET GTID_PURGED to output (MySQL, default: AUTO)--single-transaction=true- Issue BEGIN before dumping (MySQL, default: true)--skip-column-statistics- Turn off ANALYZE table statements (MySQL)--skip-comments- Do not write additional information--skip-extended-insert- Turn off extended-insert (MySQL)--skip-lock-tables- Turn off table locking--skip-quick- Do not retrieve rows one at a time
db:dump-user
Produces a sanitized database dump targeting user-related tables for seeding purposes.db:dump-wiki.
Location: app/Console/Commands/Storage/Admin/UserDumpCommand.php:9
db:dump-admin
Produces a sanitized database dump targeting admin-related tables for seeding purposes.db:dump-wiki.
Location: app/Console/Commands/Storage/Admin/AdminDumpCommand.php:9
db:dump-auth
Produces a sanitized database dump targeting auth-related tables for seeding purposes.db:dump-wiki.
Location: app/Console/Commands/Storage/Admin/AuthDumpCommand.php:9
db:dump-list
Produces a sanitized database dump targeting list-related tables (playlists, external profiles) for seeding purposes.db:dump-wiki.
Location: app/Console/Commands/Storage/Admin/ListDumpCommand.php:9
db:dump-document
Produces a sanitized database dump targeting document-related tables for seeding purposes.db:dump-wiki.
Location: app/Console/Commands/Storage/Admin/DocumentDumpCommand.php:9
db:dump-discord
Produces a sanitized database dump targeting discord-related tables for seeding purposes.db:dump-wiki.
Location: app/Console/Commands/Storage/Admin/DiscordDumpCommand.php:9
Database Sync
db:sync
Sync the local database with the latest dumps from the production server.--drop- Drop and recreate the database before syncing
- Optionally drops and recreates the database
- Truncates wiki-related tables
- Downloads and imports the latest wiki dump from https://dump.animethemes.moe/latest/wiki
- Runs database migrations
- Seeds permissions, roles, and features
- Imports models for Scout search
Storage Commands
Dump Pruning
prune:dump
Remove old database dump files from storage.-H, --hours=72- The number of hours to retain dumps (default: 72)
Reconciliation Commands
Reconciliation commands perform set reconciliation between object storage and the database.reconcile:dump
Perform set reconciliation between object storage and the dump database table.reconcile:video
Reconcile video files between storage and database.reconcile:audio
Reconcile audio files between storage and database.reconcile:script
Reconcile video script files between storage and database.Model Commands
like:sync-aggregates
Synchronize like counts in the aggregates table.playlist:fix
Fix playlist tracks to remove cycles and ensure proper ordering.playlistId- The ID of the playlist to fix
GraphQL Commands
graphql:print-schema
Print the GraphQL schema in SDL (Schema Definition Language) format.schema- The schema name to print (default: v1)
Command Best Practices
Dump Commands
- Use appropriate dump types: Choose the specific dump command for your needs (wiki, user, admin, etc.)
- Set character set: Always use
--default-character-set=utf8for consistency - Use transactions: Keep
--single-transaction=truefor consistent snapshots - Skip statistics: Use
--skip-column-statisticsto reduce dump size
Database Sync
- Use in development only: Never run in production
- Backup first: Always backup your local database before syncing
- Use —drop for clean state: When starting fresh, use the
--dropflag
Reconciliation
- Run regularly: Schedule reconciliation commands to run periodically
- Monitor output: Check command output for inconsistencies
- Run after imports: Always reconcile after bulk imports or migrations