-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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: Embedded entities with entity schema #8626
feat: Embedded entities with entity schema #8626
Conversation
src/metadata/types/TableTypes.ts
Outdated
@@ -1,4 +1,4 @@ | |||
/** | |||
* Table type. Tables can be closure, junction,, etc. | |||
*/ | |||
export type TableType = "regular"|"view"|"junction"|"closure"|"closure-junction"|"entity-child"; | |||
export type TableType = "regular"|"view"|"junction"|"closure"|"closure-junction"|"entity-child"|"embedded"; |
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 doubt we need it. Embeds already supported and everything work correctly without this new table type. You just need properly convert entity schema definitions into metadata just like what decorator-based stuff does.
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.
@pleerock I did a lot of changes. Could you check again?
6a0885c
to
cc323f8
Compare
docs/separating-entity-definition.md
Outdated
|
||
export const NameEntitySchema = new EntitySchema<Name>({ | ||
name: "name", | ||
target: Name, // target field is required for Embedded Entity! |
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.
It should not be required. We should be able to use entity schemas without targets for sure. Most people don't use entity schemas without classes, just with a regular types/interfaces.
cc323f8
to
fd14155
Compare
Added `embeddeds` field into EntitySchemaOptions Added transformation to MetadataArgsStorage for embedded entities Updated docs Created new tests cases for EntitySchema with Embedded Entities Changed type for field: `target` in EmbeddedMetadataArgs CLOSES: typeorm#3632
fd14155
to
a18164a
Compare
Think we can merge it. |
Thanks for contribution! |
Description of change
embeddeds
field into EntitySchemaOptionstarget
in EmbeddedMetadataArgsPull-Request Checklist
master
branchnpm run lint
passes with this changenpm run test
passes with this change