Skip to content

Commit

Permalink
feat: add orphanedRowAction option to EntitySchemaRelationOptions (#…
Browse files Browse the repository at this point in the history
…7625)

Adds support for setting the action for orphaned relation rows when using separate entity definitions

Fixes #7417

Co-authored-by: Jamieson Baker <jamieson@sophus.com.au>
  • Loading branch information
JamieWritesCode and Jamieson Baker authored May 8, 2021
1 parent 5fde0ea commit a8eb49a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/entity-schema/EntitySchemaRelationOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,8 @@ export interface EntitySchemaRelationOptions {
*/
deferrable?: DeferrableType;

/**
* When a child row is removed from its parent, determines if the child row should be orphaned (default) or deleted.
*/
orphanedRowAction?: "nullify" | "delete";
}
3 changes: 2 additions & 1 deletion src/entity-schema/EntitySchemaTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export class EntitySchemaTransformer {
onUpdate: relationSchema.onUpdate,
deferrable: relationSchema.deferrable,
primary: relationSchema.primary,
persistence: relationSchema.persistence
persistence: relationSchema.persistence,
orphanedRowAction: relationSchema.orphanedRowAction
}
};

Expand Down

0 comments on commit a8eb49a

Please sign in to comment.