On delete: models.CASCADE? | Community
Skip to main content
Level 6
November 14, 2023
Solved

On delete: models.CASCADE?

  • November 14, 2023
  • 1 reply
  • 655 views

How to tell Campaign that if a record is deleted in table A, the same record, based on a field that would act as a Foreign Key, should also be deleted?

Is there any configuration I can do in the schema, so I get the on_delete=models.CASCADE other DB have?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ParthaSarathy

Hi @god_prophet ,

In the schema defination, in element tag of the link add integrity="own" (deleting the source occurrence leads to the deletion of the target occurrence)

To know about other possible integrity values, refer this document 

 

integrity (optional): referential integrity of the occurrence of the source table to the occurrence of the target table. Possible values are as follows:

  • define: it is possible to delete the source occurrence if it is no longer referenced by a target occurrence,
  • normal: deleting the source occurrence initializes the keys of the link to the target occurrence (default mode), this type of integrity initializes all foreign keys,
  • own: deleting the source occurrence leads to the deletion of the target occurrence,
  • owncopy: the same as own (in case of deletion) or duplicates the occurrences (in case of duplication),
  • neutral: does nothing.

1 reply

ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
November 15, 2023

Hi @god_prophet ,

In the schema defination, in element tag of the link add integrity="own" (deleting the source occurrence leads to the deletion of the target occurrence)

To know about other possible integrity values, refer this document 

 

integrity (optional): referential integrity of the occurrence of the source table to the occurrence of the target table. Possible values are as follows:

  • define: it is possible to delete the source occurrence if it is no longer referenced by a target occurrence,
  • normal: deleting the source occurrence initializes the keys of the link to the target occurrence (default mode), this type of integrity initializes all foreign keys,
  • own: deleting the source occurrence leads to the deletion of the target occurrence,
  • owncopy: the same as own (in case of deletion) or duplicates the occurrences (in case of duplication),
  • neutral: does nothing.
~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups