flowchart TD
Start[Start with discovered databases] --> CheckInclude{include_patterns<br/>non-empty?}
CheckInclude -->|Yes| StartEmpty[Start with empty set]
CheckInclude -->|No| StartAll[Start with all databases]
StartEmpty --> AddMatches[Add databases matching<br/>any include pattern]
StartAll --> ApplyExclude[Remove databases matching<br/>any exclude pattern]
AddMatches --> ApplyExclude
ApplyExclude --> Result[Return filtered list]
Extend Multi-Database Config and Filter Engine with Include Patterns
Overview
Add include pattern support to multi-database filtering with additive semantics (pg_dump-like behavior). This enables precise database selection for targeted collection workflows.
Scope
What's Included:
MultiDatabaseConfiginfile:dbsurveyor-core/src/adapters/config/multi_database.rs:include_patterns: Vec<String>fieldwith_include_patterns(patterns: Vec<String>)filter_databases()infile:dbsurveyor-core/src/adapters/postgres/multi_database.rs:include_patternsis empty: start with all databases (current behavior)include_patternsis non-empty: start with empty set, add databases matching any include patternglob_match()function for pattern matchingfile:dbsurveyor-collect/src/main.rs:--include-databases <PATTERNS>flag (comma-separated glob patterns)Vec<String>and pass toMultiDatabaseConfigWhat's Explicitly Out:
*and?for v1.0)Filter Logic
flowchart TD Start[Start with discovered databases] --> CheckInclude{include_patterns<br/>non-empty?} CheckInclude -->|Yes| StartEmpty[Start with empty set] CheckInclude -->|No| StartAll[Start with all databases] StartEmpty --> AddMatches[Add databases matching<br/>any include pattern] StartAll --> ApplyExclude[Remove databases matching<br/>any exclude pattern] AddMatches --> ApplyExclude ApplyExclude --> Result[Return filtered list]Acceptance Criteria
MultiDatabaseConfig.include_patternsfield exists and serializes correctly--include-databases "app_*,analytics_*"correctly filters database list*and?work correctly (reuse existingglob_match()tests)References
spec:de2eeeb8-bfeb-4a11-98aa-84efc70568b2/820ca524-8c7d-4939-8097-f1158e7d67ea(Tech Plan - Filter Engine Component)spec:de2eeeb8-bfeb-4a11-98aa-84efc70568b2/661dbe3d-b679-4287-991e-26f4a0dd98b9(Flow 2 - flag-driven filtering)spec:de2eeeb8-bfeb-4a11-98aa-84efc70568b2/64fc1d47-e1e3-40db-a5dc-8dc9c248814c(v1.0 Must Have - flag-driven filters with glob support)