You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In multi-database architectures, you can restrict a migration to specific named connections. This is useful when different databases serve different purposes (e.g., one for user data, another for reporting):
347
+
348
+
```php
349
+
class CreateReportsTable extends AbstractMigration {
350
+
public function getTargetConnections(): array {
351
+
return ['reporting-db']; // Only runs against the 'reporting-db' connection
352
+
}
353
+
354
+
public function up(Database $db): void {
355
+
// ...
356
+
}
357
+
358
+
public function down(Database $db): void {
359
+
// ...
360
+
}
361
+
}
362
+
```
363
+
364
+
Migrations with an empty `getTargetConnections()` (the default) run on all connections. The connection name comes from `ConnectionInfo::getName()`.
0 commit comments