tenancy / multi-tenant

Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant
https://tenancy.dev
MIT License
2.56k stars 394 forks source link

Squash migrations #1005

Closed mapeveri closed 3 years ago

mapeveri commented 3 years ago

Hi everyone,

I would like to know if pumpkin migrations are possible. Check the commands and documentation and I cannot see this function.

Thanks

stein-j commented 3 years ago

No, the package has nothing for using Laravel's new squashing system. This is a feature this package really needs because every new tenants needs to go through every single migrations, I have 200+ migrations and it's taking for ever to create a new tenant. I've done some testing there I think is a way to do it -ish:

If you want to squash, you need to run the command on a tenant php artisan tenancy:run schema:dump --tenant=1 this should work correctly and dump the file database/schema/tenant-schema.dump.This should now work when creating a new tenant, if it doesn't you might want to force the connection name in the settings to tenant.

Note, I found two issues :

Hope this gives you a lead.

mapeveri commented 3 years ago

@stein-j thank you so much, it's working :)

stein-j commented 3 years ago

@mapeveri awesome ! You can close the issue then :)