pub fn cleanup_test_dbs_cmd(
dry_run: bool,
yes: bool,
maintenance_database: String,
allow_non_localhost: bool,
workspace: Option<PathBuf>,
) -> ExitCodeExpand description
djogi db cleanup-test-dbs entry point — drops orphaned
djogi_test_<uuid> databases left behind by #[djogi_test] runs
killed by SIGKILL / OOM / panic-after-spawn before
djogi::testing::teardown_test_db could fire.
Triple-gated identical to db reset:
- Localhost.
DjogiConfig::database.urlMUST resolve to127.0.0.1/localhost/[::1], unless the operator passed--allow-non-localhostto override (parity withdb seed’s lighter gate — sometimes operators run a remote dev cluster). - Non-production.
Djogi.toml::profileMUST NOT equal"production". Mirrorsdb reset’s second gate so the same rules govern any operation that issuesDROP DATABASE. - Confirmation.
--yesis required, unless--dry-runis passed.--dry-runlists candidates without dropping; no confirmation needed because no side effect occurs.maintenance_databasedefaults to"postgres"— the conventional administrative DB present on every cluster — and is spliced intodatabase.url’s path component to produce the admin connection URL (the application database itself can’t drop other databases on the same cluster). Exit codes match thedbmatrix at the top of this module:0on success,1on runtime / SQL / connect failure,2on gate refusal (non-localhost without override, production profile, missing--yes).