CRM-20958 - Extract helper Civi\Core\SqlTrigger\TimestampTriggers
authorTim Otten <totten@civicrm.org>
Thu, 27 Jul 2017 01:08:20 +0000 (18:08 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 6 Sep 2017 17:41:02 +0000 (10:41 -0700)
commit6050e9ad11556cf2f67cbe5b0faaee374633c2d8
tree9ae413ec285a9b529d86dfb427be6a6cf698288f
parentf6cecca82b633c59425f51d27f7ae0db689233fc
CRM-20958 - Extract helper Civi\Core\SqlTrigger\TimestampTriggers

== Before ==

 * SQL triggers to populate `civicrm_contact.created_date` and  `civicrm_contact.modified_date` are
   generate via `CRM_Contact_BAO_Contact::triggerInfo($info, $tableName)`

== After ==

 * `CRM_Contact_BAO_Contact::triggerInfo` calls a helper `TimestampTriggers`
 * The helper `TimestampTriggers` accepts arguments describing the names of the tables/columns
   which needed for the timestamp triggers.

== Comments ==

To test, I used this command to update and dump the schema:

```
cv api system.flush triggers=1 && mysqldump --triggers ...
```

The schema was identical before and after.  (Notably, by alternately hacking
the code, I was able to validate the test was capable of revealing
discrepencies.)
CRM/Contact/BAO/Contact.php
Civi/Core/SqlTrigger/TimestampTriggers.php [new file with mode: 0644]