Open tjhunkin-inhance opened 10 months ago
Sorry for my late reply on this issue; I was off the internet for the past 2 weeks.
I haven't used spatie/laravel-multitenancy
yet, so I don't know how the package works.
Solving this issue sounds complicated to be honest. I think the best user experience would be, that you as a user can select which db-dump is being imported into which database connection. (Imagine being prompted to select the database connection in the CLI)
But when should this logic trigger? Should the package check if the host application has spatie/laravel-multitenancy
installed? What about stancl/tenancy
? Does the package then have to behave differently for each tenancy flavour?
I'm currently not tackling this issue as I can't see a good solution for this. However, I'm more than happy to discuss potential solutions here in public and will leave this issue open for a certain amount of time.
Perhaps the user can specify a flag like --multiple-databases or detect multiple SQL files in the backup, but then you can only restore one database at a time by specifying the connection and a dump name.
I use Spatie Multitenancy which requires a landlord and tenant database.
This package tries to restore the dump file of the landlord database into the tenant database in MySql->getImportCommand
Spatie Backup allows the specification of multiple databases in the backup config.
You would need to do a contains or something checking the database name in the connections versus the dumped databases to match which restores where.