laravel-ide-helper icon indicating copy to clipboard operation
laravel-ide-helper copied to clipboard

Allow table inspection in several database connections at once

Open vpratfr opened this issue 2 years ago • 1 comments

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

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update
  • [ ] Misc. change (internal, infrastructure, maintenance, etc.)

Checklist

  • [ ] Existing tests have been adapted and/or new tests have been added
  • [ ] Add a CHANGELOG.md entry
  • [ ] Update the README.md
  • [ ] Code style has been fixed via composer fix-style

vpratfr avatar Dec 16 '21 11:12 vpratfr

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.

vpratfr avatar Jan 09 '22 13:01 vpratfr