barryvdh / laravel-ide-helper

IDE Helper for Laravel
MIT License
14.17k stars 1.16k forks source link

Allow table inspection in several database connections at once #1285

Open vpratfr opened 2 years ago

vpratfr commented 2 years ago

fixes #1141 and probably fixes #1280 too which looks like a side effect of that original issue.

Currently the package cannot handle schema discovery in more than a single database at once. In multi-tenant applications it is very frequent that there are at least two databases active at some point in time: landlord (data common to all tenants) and tenant (specific to one tenant).

When the configuration variable db_mapping is not specified, it defaults to null which then makes the code strictly behave as before. Hence this introduces no breaking change.

Summary

Type of change

Checklist

vpratfr commented 2 years ago

Giving a way to hook into this part of the code would be fine for us. The issue we have is that there is no way to plug any logic into that part of the code as of now.

That said, this is not even a matter of multi-tenancy: any app which uses 2 or more DB connections to fetch it's data from is exposed to the same issue. Multi-tenancy is just the most common use case for such a need.

To me, allowing to specify a physical DB name in front of a logical connection name is not specific to multi-tenancy. Again, if I store data in 2 different DBs, I'd see the same issue.