From 6d32997b697aee1506d088305a5c681c3fd4336f Mon Sep 17 00:00:00 2001 From: alexeh Date: Fri, 25 Oct 2024 05:51:30 +0200 Subject: [PATCH] specify cascade insert --- shared/entities/base-data.entity.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/shared/entities/base-data.entity.ts b/shared/entities/base-data.entity.ts index 9fb5dd01..929898bb 100644 --- a/shared/entities/base-data.entity.ts +++ b/shared/entities/base-data.entity.ts @@ -271,6 +271,9 @@ export class BaseData extends BaseEntity { @OneToOne( "EmissionFactors", (emissionFactors: EmissionFactors) => emissionFactors.baseData, + { + cascade: ["insert"], + }, ) @JoinColumn({ name: "emission_factors", @@ -282,6 +285,9 @@ export class BaseData extends BaseEntity { "BaselineReassessment", (baselineReassessment: BaselineReassessment) => baselineReassessment.baseData, + { + cascade: ["insert"], + }, ) @JoinColumn({ name: "baseline_reassessment", @@ -289,7 +295,9 @@ export class BaseData extends BaseEntity { }) baselineReassessment: BaselineReassessment; - @OneToOne("MRV", (mrv: MRV) => mrv.baseData) + @OneToOne("MRV", (mrv: MRV) => mrv.baseData, { + cascade: ["insert"], + }) @JoinColumn({ name: "mrv", referencedColumnName: "id", @@ -300,6 +308,9 @@ export class BaseData extends BaseEntity { "BlueCarbonProjectPlanning", (blueCarbonProjectPlanning: BlueCarbonProjectPlanning) => blueCarbonProjectPlanning.baseData, + { + cascade: ["insert"], + }, ) @JoinColumn({ name: "blue_carbon_project_planning", @@ -311,6 +322,9 @@ export class BaseData extends BaseEntity { "LongTermProjectOperating", (longTermProjectOperating: LongTermProjectOperating) => longTermProjectOperating.baseData, + { + cascade: ["insert"], + }, ) @JoinColumn({ name: "long_term_project_operating", @@ -321,6 +335,9 @@ export class BaseData extends BaseEntity { @OneToOne( "SequestrationRate", (sequestrationRate: SequestrationRate) => sequestrationRate.baseData, + { + cascade: ["insert"], + }, ) @JoinColumn({ name: "sequestration_rate",