Skip to content

Commit

Permalink
add new persistableRelationship behavior for spring-data-relational
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Nov 23, 2023
1 parent e37ca42 commit f7f091f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions generators/spring-data-relational/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ export default class SqlGenerator extends BaseApplicationGenerator<SpringBootGen
return this.delegateTasksToBlueprint(() => this.preparing);
}

get preparingEachEntity() {
return this.asPreparingEachEntityTaskGroup({
prepareEntity({ entity }) {
entity.relationships.forEach(relationship => {
if (relationship.persistableRelationship === undefined) {
// This is a v8.1 behavior, make it default if blueprints adopts it.
relationship.persistableRelationship = relationship.ownerSide || relationship.relationshipType === 'many-to-many';
}
});
},
});
}

get [BaseApplicationGenerator.PREPARING_EACH_ENTITY]() {
return this.delegateTasksToBlueprint(() => this.preparingEachEntity);
}

get preparingEachEntityRelationship() {
return this.asPreparingEachEntityRelationshipTaskGroup({
prepareRelationship({ application, relationship }) {
Expand Down

0 comments on commit f7f091f

Please sign in to comment.