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
feat(core): allow setting default schema
on EntityManager
#4717
Conversation
Forked `EntityManager` can apply a default schema
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like the idea, but the implementation can simplified
fix: shallow copy options in count to avoid racing condition in findAndCount
Codecov ReportPatch coverage is
📢 Thoughts on this report? Let us know!. |
So I guess the last missing thing is to document this somewhere? We should also come up with a better commit message as this is a bit too generic for what this PR is actually doing. |
I've tested some more with request context and found an issue. I think we need to change |
I don't follow, change it where? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you plan to make more changes, we can merge.
schema
on EntityManager
fork
schema
on EntityManager
forkschema
on EntityManager
Thanks! |
Hi,
I want to start with thanking you all for this great ORM that is so actively maintained and offer so many great features. One thing that really catches my eye is the per request (shell)EntityManager that I think will make this ORM a winner when it comes to multi tenancy. Almost all of the other big ORM libraries are based on a global concept.
My aim with this PR is to make a shoot at implementing schema based multi tenancy support with help of the per request EntityManager. With this PR it's possible to set a schema when forking the EntityManager. That schema will be applied as a default schema if no other schema is present. It makes use of the schema options introduced in: #2296
If this seems like an approach to pursue there is some more work to do:
Some questions
this.context()
calls be reduced?.fork()
an existing fork with schema, should schema be inherited and should it be possible to clear schema?