Summary
Add CLI-level support for connection-targeted migrations and seeders, building on DatabaseChange::getTargetConnections() being added in WebFiori/database#149.
Context
The webfiori/database package is adding a getTargetConnections(): array method to DatabaseChange that allows migrations/seeders to declare which named connections they apply to. The filtering logic lives in SchemaRunner. This issue covers the framework-level integration needed to make the feature usable and safe.
Required Work
1. CLI flags
- Add
--connection=<name> flag to migration/seeder commands
- Pass the connection name to
SchemaRunner so filtering works
2. Connection name validation
- When a migration declares target connections, validate those names against the framework connection registry
- Warn (or error) if a declared target connection name does not exist in the registry
- Warn if the
SchemaRunner connection has the default name (New_Connection) and target-connection filtering is in use
3. Multi-connection orchestration
- Consider a
--all-connections flag that runs migrations against each registered connection in sequence
- Each run filters to migrations targeting that connection (or targeting all)
4. CLI output
- Show skipped migrations with reason:
Skipped: Connection mismatch (targets: reporting-db)
- Consistent with existing environment mismatch output
5. fresh / reset command behavior
migrations:fresh should only drop/re-apply migrations that target the current connection
- Migrations targeting other connections should not be touched
- Document edge case: if targeting was changed after initial apply
6. Typo detection (nice-to-have)
- After discovery, compare all declared
getTargetConnections() values against registered connection names
- Emit warnings for unrecognized connection names (likely typos)
Related
Breaking Changes
None — additive CLI flags only.
Summary
Add CLI-level support for connection-targeted migrations and seeders, building on
DatabaseChange::getTargetConnections()being added in WebFiori/database#149.Context
The
webfiori/databasepackage is adding agetTargetConnections(): arraymethod toDatabaseChangethat allows migrations/seeders to declare which named connections they apply to. The filtering logic lives inSchemaRunner. This issue covers the framework-level integration needed to make the feature usable and safe.Required Work
1. CLI flags
--connection=<name>flag to migration/seeder commandsSchemaRunnerso filtering works2. Connection name validation
SchemaRunnerconnection has the default name (New_Connection) and target-connection filtering is in use3. Multi-connection orchestration
--all-connectionsflag that runs migrations against each registered connection in sequence4. CLI output
Skipped: Connection mismatch (targets: reporting-db)5.
fresh/resetcommand behaviormigrations:freshshould only drop/re-apply migrations that target the current connection6. Typo detection (nice-to-have)
getTargetConnections()values against registered connection namesRelated
ConnectionInfo::getName()— connection name used for matchingBreaking Changes
None — additive CLI flags only.