Commit | Line | Data |
---|---|---|
6a488035 | 1 | -- +--------------------------------------------------------------------+ |
6b7eb9df | 2 | -- | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 3 | -- | | |
6b7eb9df TO |
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 | | |
6a488035 TO |
7 | -- +--------------------------------------------------------------------+ |
8 | ||
9 | DELIMITER | | |
10 | ||
11 | CREATE TRIGGER civicrm_contact_ad | |
12 | BEFORE DELETE ON civicrm_contact | |
13 | FOR EACH ROW | |
14 | BEGIN | |
15 | -- we delete the corresponding entity_id/entity_table entries | |
16 | -- from all the linked tables (note, log etc) | |
17 | DELETE FROM civicrm_note | |
c213dee5 | 18 | WHERE entity_id = OLD.id |
6a488035 TO |
19 | AND entity_table = 'civicrm_contact'; |
20 | DELETE FROM civicrm_log | |
21 | WHERE entity_id = OLD.id | |
22 | AND entity_table = 'civicrm_contact'; | |
c213dee5 | 23 | DELETE FROM civicrm_task_status |
6a488035 TO |
24 | WHERE responsible_entity_id = OLD.id |
25 | AND responsible_entity_table = 'civicrm_contact'; | |
26 | ||
27 | END; | |
28 | ||
29 | CREATE TRIGGER civicrm_contribution_ad | |
30 | BEFORE DELETE ON civicrm_contribution | |
31 | FOR EACH ROW | |
32 | BEGIN | |
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'; | |
36 | END; | |
37 | ||
38 | CREATE TRIGGER civicrm_participant_ad | |
39 | BEFORE DELETE ON civicrm_participant | |
40 | FOR EACH ROW | |
41 | BEGIN | |
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'; | |
46 | END; | |
47 | ||
48 | | | |
49 | ||
50 | DELIMITER ; | |
51 |