1 -- +--------------------------------------------------------------------+
2 -- | Copyright CiviCRM LLC. All rights reserved. |
4 -- | This work is published under the GNU AGPLv3 license with some |
5 -- | permitted exceptions and without any warranty. For full license |
6 -- | and copyright information, see https://civicrm.org/licensing |
7 -- +--------------------------------------------------------------------+
11 CREATE TRIGGER civicrm_contact_ad
12 BEFORE DELETE ON civicrm_contact
15 -- we delete the corresponding entity_id/entity_table entries
16 -- from all the linked tables (note, log etc)
17 DELETE FROM civicrm_note
18 WHERE entity_id = OLD.id
19 AND entity_table = 'civicrm_contact';
20 DELETE FROM civicrm_log
21 WHERE entity_id = OLD.id
22 AND entity_table = 'civicrm_contact';
23 DELETE FROM civicrm_task_status
24 WHERE responsible_entity_id = OLD.id
25 AND responsible_entity_table = 'civicrm_contact';
29 CREATE TRIGGER civicrm_contribution_ad
30 BEFORE DELETE ON civicrm_contribution
33 -- we delete the corresponding entity_id/entity_table entries
34 -- from all the linked tables (note, log etc)
35 DELETE FROM civicrm_note WHERE entity_id = OLD.id AND entity_table = 'civicrm_contribution';
38 CREATE TRIGGER civicrm_participant_ad
39 BEFORE DELETE ON civicrm_participant
42 -- we delete the corresponding entity_id/entity_table entries
43 -- from all the linked tables (note, log etc)
44 DELETE FROM civicrm_note WHERE entity_id = OLD.id AND entity_table = 'civicrm_participant';
45 DELETE FROM civicrm_log WHERE entity_id = OLD.id AND entity_table = 'civicrm_participant';