Avatar

Level 2

Hi,

I am not sure if I understand referential integrity in Adobe Campaign Properly

Basically I want to create a new schema "Pledges" which is linked to the Recipient table, it will contain a list of pledges that the recipient has made.

I have created the schema (example below) which is fine but I wanted for when a recipient is deleted for the pledges to be deleted as well through a cascaded delete of some form but not sure how to achieve this.

At the moment I can delete either the recipient record or the pledge record without any effect on the other.

The following is what I have tried so far (database postgresql):

<srcSchema _cs="Pledges (nt)" created="2019-11-20 20:42:57.965Z" createdBy-id="0"

           desc="Pledge" entitySchema="xtk:srcSchema" img="xtk:schema.png" label="Pledges"

           labelSingular="Pledge" lastModified="2019-11-21 12:17:26.933Z" mappingType="sql"

           md5="AD17FA7CD5BA316C7EDAD382B8D4C1B3" modifiedBy-id="0" name="Pledges"

           namespace="nt" xtkschema="xtk:srcSchema">

  <element desc="Pledge" label="Pledges" labelSingular="Pledge" name="Pledges">

    <key internal="true" name="pledge">

      <keyfield xpath="@recipientId"/>

      <keyfield xpath="@pledgeCode"/>

    </key>

    <attribute label="Recipient ID" name="recipientId" type="long"/>

    <attribute label="Pledge Code" name="pledgeCode" type="string"/>

    <attribute label="Consent given" name="consent" type="boolean"/>

    <element integrity="neutral" label="Recipient" name="recipient" revIntegrity="own"

             revLabel="pledges" revLink="pledges" target="nms:recipient" type="link">

      <join xpath-dst="@id" xpath-src="@recipientId"/>

    </element>

  </element>

</srcSchema>