Last active
September 9, 2017 21:01
-
-
Save mlutfy/6e08a51c6878cc05077e616213ec165e to your computer and use it in GitHub Desktop.
CiviCRM logging timestamp weird bug (CRM/Logging/Schema.php)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fix timestamp. | |
* | |
* Log_civicrm_contact.modified_date for example would always be copied from civicrm_contact.modified_date, | |
* so there's no need for a default timestamp and therefore we remove such default timestamps | |
* also eliminate the NOT NULL constraint, since we always copy and schema can change down the road) | |
* | |
* @param string $query | |
* | |
* @return mixed | |
*/ | |
public function fixTimeStampAndNotNullSQL($query) { | |
$query = str_ireplace("TIMESTAMP NOT NULL", "TIMESTAMP NULL", $query); | |
$query = str_ireplace("DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", '', $query); | |
$query = str_ireplace("DEFAULT CURRENT_TIMESTAMP", '', $query); | |
$query = str_ireplace("NOT NULL", '', $query); | |
$query = str_ireplace('()', ' ', $query); // [ML] | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment