Search code examples
laravelmulti-tenant

Laravel Spatie Multitenancy: specific migration for specific tenant


I use spatie/multitenancy version 1 with Laravel 7.x. As I am new to multitenancy, I am stuck with the following problem.

Normally when I make a migration, all tenants database will be migrate. Instead of this, if I want to migrate specific migration file for specific tenant database, how can I do this? Is it possible?


Solution

  • From what I understand from the docs, you can specify you can run the tenants artisan command for a specific tenant with the tenant option. E.g

    php artisan tenants:artisan "migrate --seed" --tenant=123

    Where tenant is the tenant's id.