-
-
Notifications
You must be signed in to change notification settings - Fork 498
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): add support for multiple schemas (including UoW) #2296
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2296 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 186 186
Lines 10311 10366 +55
Branches 2255 2274 +19
=========================================
+ Hits 10311 10366 +55
Continue to review full report at Codecov.
|
Closes #2074 BREAKING CHANGE: `em.getReference()` now has options parameter.
…(WIP) Support for working with `SchemaGenerator` with specific schema. Entities can now specify `schema: '*'`, that way they will be ignored in schema generator unless `schema` option is specified. - if we have schema specified on entity level, it only exists in that schema - if we have * schema on entity, it can exist in any schema, always controlled by the parameter - no schema on entity - default schema or from global orm config
Thanks a lot for this feature! |
Should this breaking change also be described in the |
Oh yes, I must have missed that, sorry. Good job! |
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
Entity instances now hold schema name (as part of
WrappedEntity
). Managed entities will have the schema fromFindOptions
or metadata. Methods that create new entity instances likeem.create()
orem.getReference()
now have an options parameter to allow setting the schema. We can also usewrap(entity).setSchema()
.Entities can now specify
@Entity({ schema: '*' })
, that way they will be ignored inSchemaGenerator
unlessschema
option is specified.Closes #2074
BREAKING CHANGE:
em.getReference()
now has options parameter.