Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Multi Tenancy/DB handling #172

Open
Shotman opened this issue Jun 5, 2024 · 2 comments
Open

[Question] Multi Tenancy/DB handling #172

Shotman opened this issue Jun 5, 2024 · 2 comments

Comments

@Shotman
Copy link

Shotman commented Jun 5, 2024

Hello I'm really interested in this bundle but I have some question I can't really seem to find in the docs

I'm using https://github.com/RamyHakam/multi_tenancy_bundle to manage multi databases dynamically
How would I go about using the backup/restore features given that DB credentials are stored in the main app DB ?

@pounard
Copy link
Member

pounard commented Jun 5, 2024

That's a very interesting question. I'll try to answer to it the best I can.

TL;DR: This wasn't a planned feature until now, so there is no documentation. But, now that we know, it may become a new planned feature. But hey, please take so time to read below as well!

First, I didn't even knew about this bundle, it seems interesting. Still since we didn't knew it existed, we didn't have planned to integrate to it. Nevertheless, if it's not hacking too ugly around Doctrine, it should be relatively easy to seamlessly integrate with it.

One important thing, in the middle of our library, there is a component called the "database session registry", it's an interface. Basically, it gives you a list of database connection, along with their names, and which one is default. This is the center of all things, and our entry point if we want to fetch database connections another way.

So, as stated upper, the database connection source can be pretty much anything, as long as we can convert the underlaying connection to a makinacorpus/query-builder database session (so this include PDO connections, Doctrine connections, and in the future, some more such as ext-pgsql connections).

If the multi tenancy bundle does things right, it should be almost trivial to write a new database session registry instance for it.

As I expect to have some in-between client contracts in the next few days or weeks, I'll maybe try to integrate with it (no promises here, it'll much depend on my motivation and on the work stumbling upon me, or on my other colleagues).

As always, we are opened to new feature requests and pull requests, so any contribution of you will be welcomed (and opening a discussing a feature request is a contribution in itself, you are not forced to code anything).

@Shotman
Copy link
Author

Shotman commented Jun 5, 2024

Thanks for the detailed answer.

I'll try to read the code when I have time and figure out how it works internally and maybe try a draft PR or at least write some specs on how I'd imagine the workflow to be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants