henryavila/laravel-multi-database-commands
A Laravel package that adds Artisan commands for working with multiple database connections, letting you run migrations, seeders, rollbacks, and related database tasks across all configured connections from one command.
composer require henryavila/laravel-multi-database-commands. v2.1.0 adds Laravel 11 support (PHP 8.2+), alongside the existing Laravel 10 line; there are no documented breaking changes from v2.0.0, so upgrading is a composer update away. On Laravel 11, run php artisan vendor:publish --tag=multidatabase-config (or check config/multidatabase.php) to review the connection list.config/multidatabase.php (or config/database.php if the package reads connections directly). This is where you declare which connections the *:all-style Artisan commands should iterate. The default typically mirrors every entry in config/database.php, which is rarely what you want in production.analytics, a tenant shard, or a read replica), then run php artisan migrate:all (or the package's migrator command) to push the same migrations across every configured connection in one shot. Verify with php artisan migrate:status:all before trusting it in any shared environment.config/multidatabase.php (or resolve them in a service provider), then run the package's migrate:all / migrate:fresh:all commands. This is the core workflow the package exists for — one artisan invocation, N databases.php artisan migrate:all --force into your deploy pipeline for environments with multiple databases. Because the command loops connections sequentially, a failure on one connection usually halts or surfaces immediately — pair it with your existing migrate health checks per connection.db:seed:all (or equivalent) command to keep reference/lookup data synchronized across connections without writing custom loops.Artisan::call('migrate:all', [...]) inside a job or tenant-provisioning service so new tenant databases get the current schema on creation.app()->environment() checks) so local runs don't accidentally hit replica or shard connections.migrate:all, run the status command across connections and diff the results in your own script — the package gives you the fan-out, not a cross-connection drift report.tenants table) must be resolved at runtime, not baked into config/multidatabase.php, or php artisan config:cache will freeze them. Resolve tenant lists in a service provider or pass them at call time instead.migrate:all again should be safe), and always take a snapshot before running migrate:fresh:all anywhere non-local.migrate:fresh:all is destructive across every connection. Confirm the connection list is scoped (e.g. excludes a production/archive connection) before running. A stray default config is the most common way this goes wrong.php artisan list and confirm the *:all commands are present.bootstrap/cache and php artisan optimize:clear before assuming a package regression.-v to see per-connection output; the commands typically echo the connection name before each run, which is your fastest signal for which connection is failing.DatabaseSeeder resolves correctly per connection rather than referencing a connection-pinned model.How can I help you explore Laravel packages today?