feat(migrate): per-tenant onboarding backfill + revert + CLI (#132 part 2)
CI / Check (pull_request) Successful in 8m15s
CI / Detect Changes (pull_request) Has been skipped
CI / Deploy Agent (pull_request) Has been skipped
CI / Deploy Dashboard (pull_request) Has been skipped
CI / Deploy Docs (pull_request) Has been skipped
CI / Deploy MCP (pull_request) Has been skipped
CI / Check (pull_request) Successful in 8m15s
CI / Detect Changes (pull_request) Has been skipped
CI / Deploy Agent (pull_request) Has been skipped
CI / Deploy Dashboard (pull_request) Has been skipped
CI / Deploy Docs (pull_request) Has been skipped
CI / Deploy MCP (pull_request) Has been skipped
Wire the id-preserving mappers into a runnable, idempotent, reversible migration: - backfill_onboarded_targets(db, dry_run): repositories -> onboarded_targets; dast_targets fold into the linked repo target (append LiveUrl, promote type, relink dast_scan_runs/pentest_sessions history) or migrate standalone. Skips existing (by _id), writes a schema_migrations marker; dry-run computes the report without writing. Legacy collections are never deleted. - revert(db): replay the relink log, drop onboarded_targets + the log, clear the marker — restores the pre-migration state. - CLI: `compliance-agent migrate onboarding [--all | --tenant <id>] [--dry-run] [--revert]`, with DatabasePool::list_tenant_ids for --all. - database.rs: collection_named<T> accessor + list_tenant_ids helper. Integration test (real Mongo, local-only — CI is --lib) covers fold + relink + idempotency + revert end to end. 5 mapper unit tests run in CI. Closes #132. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
fa3a6b71fb
commit
0d83859bcf
@@ -7,3 +7,4 @@
|
||||
// Or nightly: (via CI with MongoDB service container)
|
||||
|
||||
mod api;
|
||||
mod migration;
|
||||
|
||||
Reference in New Issue
Block a user