Closed mapeveri closed 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 :
It is hard coded by Laravel to store and find the schema dump file containing the database connection name. This means when running php artisan migrate
for the system database, if you have set as the default connection to "tenant" instead of "system", it will try to find your dump schema file of you tenant tenant-schema.dump
and run it in your system connection. So for this to work you need to make sur your default database connection in config/database.php is set to system
.
If you Passport as your main authentication it might conflicts with the above problem, it needs to have the default connection set to tenant
. Why exactly, I'm not sure.
Hope this gives you a lead.
@stein-j thank you so much, it's working :)
@mapeveri awesome ! You can close the issue then :)
Hi everyone,
I would like to know if pumpkin migrations are possible. Check the commands and documentation and I cannot see this function.
Thanks