dvs prune
Remove orphaned databases, users, and app configurations.
Descriptionβ
The prune command identifies and removes orphaned resources that are no longer referenced by valid applications:
- Orphaned MySQL/MariaDB databases: Databases that are not referenced by any installed application
- Orphaned SQL users: MySQL/MariaDB database users that are not referenced by any installed application
- Orphaned app configurations: App configuration directories whose
APP_ROOTorAPP_WEB_ROOTdirectories no longer exist
The command analyzes all app configurations and verifies that directories exist. Only apps with valid configurations and existing directories are considered valid.
Usageβ
dvs prune [--dry-run]
Optionsβ
--dry-run: Display what would be deleted without actually deleting anything or prompting for confirmation. Useful for previewing the results before running the actual prune command.
Important Notesβ
- Interactive: The command allows you to select which resources to delete using a multiple choice interface (unless
--dry-runis used) - Selective: You can choose to delete all resources at once or select specific ones individually
- Safe: Only resources not referenced by valid apps are shown for deletion
- Service Management: The command automatically starts MySQL/MariaDB services if they are not running
- Dry-run Mode: Use
--dry-runto preview what would be deleted without making any changes
Examplesβ
Basic Usageβ
$ dvs prune
Prune Analysis:
Orphaned databases:
- old_app_db
- test_db
Orphaned SQL users:
- old_app_user
- test_user
Select resources to delete (space to toggle, enter to confirm):
[β] All
[ ] app:pipobimbo
[ ] db:old_app_db
[ ] db:test_db
[ ] user:old_app_user
[ ] user:test_user
[ ] Cancel
Deleting orphaned resources...
Deleting database old_app_db ... β
Deleting database test_db ... β
Deleting user old_app_user ... β
Deleting user test_user ... β
Prune completed.
Dry-run Modeβ
Preview what would be deleted without making any changes:
$ dvs prune --dry-run
Prune Analysis:
Orphaned databases:
- old_app_db (from mysql-8.0)
- test_db (from mysql-8.0)
Orphaned SQL users:
- old_app_user (from mysql-8.0)
- test_user (from mysql-8.0)
Dry-run mode: The following resources would be deleted:
Orphaned databases:
- old_app_db (from mysql-8.0)
- test_db (from mysql-8.0)
Orphaned SQL users:
- old_app_user (from mysql-8.0)
- test_user (from mysql-8.0)
No changes were made (dry-run mode).
Related Commandsβ
dvs mysqlconsole- Root access to MySQL/MariaDBdvs status- List services and applications with their status