Skip to content

Commit

Permalink
Use mysql to set mailing.created_date
Browse files Browse the repository at this point in the history
On digging I determined this trigger hokiness was all about mysql
5.5 and we can ditch it now

https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-5.html#mysqld-5-6-5-data-types

and civicrm#10953 (comment)

Note that we still support mysql 5.6 and the current version is 5.6.51

I think it's fine to require that the 5.6 minimum is 5.6.5 as released in 2012

I'll do the upgrade script as a follow up
  • Loading branch information
eileenmcnaughton committed Jul 4, 2021
1 parent d132f6e commit a7a643f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CRM/Mailing/DAO/Mailing.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Mailing/Mailing.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:a2d71da677efc3436ae8ed9414cdecca)
* (GenCodeChecksum:4c28acf96d01fa990a3af7f2d72344b5)
*/

/**
Expand Down Expand Up @@ -844,7 +844,7 @@ public static function &fields() {
'description' => ts('Date and time this mailing was created.'),
'required' => FALSE,
'where' => 'civicrm_mailing.created_date',
'default' => 'NULL',
'default' => 'CURRENT_TIMESTAMP',
'table_name' => 'civicrm_mailing',
'entity' => 'Mailing',
'bao' => 'CRM_Mailing_BAO_Mailing',
Expand Down
3 changes: 3 additions & 0 deletions CRM/Upgrade/Incremental/sql/5.40.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ UPDATE civicrm_option_value SET name = 'Case'
WHERE value = 'civicrm_case' AND option_group_id = @option_group_id_tuf;
UPDATE civicrm_option_value SET name = 'File'
WHERE value = 'civicrm_file' AND option_group_id = @option_group_id_tuf;

ALTER TABLE civicrm_mailing
MODIFY COLUMN `created_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Date and time this mailing was created.';
5 changes: 0 additions & 5 deletions Civi/Core/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,6 @@ public function createContainer() {
$container->setDefinition('cache_config', new Definition('ArrayObject'))
->setFactory([new Reference(self::SELF), 'createCacheConfig'])->setPublic(TRUE);

$container->setDefinition('civi.mailing.triggers', new Definition(
'Civi\Core\SqlTrigger\TimestampTriggers',
['civicrm_mailing', 'Mailing']
))->addTag('kernel.event_listener', ['event' => 'hook_civicrm_triggerInfo', 'method' => 'onTriggerInfo'])->setPublic(TRUE);

$container->setDefinition('civi.activity.triggers', new Definition(
'Civi\Core\SqlTrigger\TimestampTriggers',
['civicrm_activity', 'Activity']
Expand Down
2 changes: 1 addition & 1 deletion xml/schema/Mailing/Mailing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
<field>
<name>created_date</name>
<type>timestamp</type>
<default>NULL</default>
<default>CURRENT_TIMESTAMP</default>
<required>false</required>
<title>Mailing Created Date</title>
<comment>Date and time this mailing was created.</comment>
Expand Down

0 comments on commit a7a643f

Please sign in to comment.