Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContributionRecur modified_date should update to current_timestamp on update #21472

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CRM/Contribute/DAO/ContributionRecur.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Contribute/ContributionRecur.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:6c94785d608dc72c00b663ee8ad4e180)
* (GenCodeChecksum:5f08744178821ce074d21fe4cdddbdaa)
*/

/**
Expand Down Expand Up @@ -97,7 +97,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
/**
* Last updated date for this record. mostly the last time a payment was received
*
* @var datetime
* @var timestamp
*/
public $modified_date;

Expand Down Expand Up @@ -450,11 +450,11 @@ public static function &fields() {
],
'contribution_recur_modified_date' => [
'name' => 'modified_date',
'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
'type' => CRM_Utils_Type::T_TIMESTAMP,
'title' => ts('Modified Date'),
'description' => ts('Last updated date for this record. mostly the last time a payment was received'),
'where' => 'civicrm_contribution_recur.modified_date',
'default' => 'CURRENT_TIMESTAMP',
'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
'table_name' => 'civicrm_contribution_recur',
'entity' => 'ContributionRecur',
'bao' => 'CRM_Contribute_BAO_ContributionRecur',
Expand Down
3 changes: 3 additions & 0 deletions CRM/Upgrade/Incremental/sql/5.43.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
UPDATE civicrm_msg_template SET is_reserved = 0 WHERE is_reserved IS NULL;
ALTER TABLE civicrm_msg_template
MODIFY COLUMN `is_reserved` tinyint(4) DEFAULT 0 COMMENT 'is this the reserved message template which we ship for the workflow referenced by workflow_id?';

{* https://github.com/civicrm/civicrm-core/pull/21472 *}
ALTER TABLE civicrm_contribution_recur MODIFY COLUMN modified_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Last updated date for this record. mostly the last time a payment was received';
5 changes: 5 additions & 0 deletions tests/phpunit/api/v3/SyntaxConformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,11 @@ public function getKnownUnworkablesUpdateSingle($entity, $key) {
'definition',
],
],
'ContributionRecur' => [
'break_return' => [
'contribution_recur_modified_date',
],
],
'Domain' => ['cant_update' => ['domain_version']],
'MembershipBlock' => [
'cant_update' => [
Expand Down
4 changes: 2 additions & 2 deletions xml/schema/Contribute/ContributionRecur.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@
<field>
<name>modified_date</name>
<title>Modified Date</title>
<type>datetime</type>
<default>CURRENT_TIMESTAMP</default>
<type>timestamp</type>
<default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default>
<comment>Last updated date for this record. mostly the last time a payment was received</comment>
<add>1.6</add>
<html>
Expand Down