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

Conversation

mattwire
Copy link
Contributor

Overview

A modified_date field should update on update... All others do!

Before

contribution_recur.modified_date does not update automatically.

After

contribution_recur.modified_date does update automatically.

Technical Details

Missing ON UPDATE CURRENT_TIMESTAMP() in definition.

Comments

@civibot
Copy link

civibot bot commented Sep 14, 2021

(Standard links)

@eileenmcnaughton
Copy link
Contributor

I think this is fine if the test is fixed & r-run testing passes

api_v3_SyntaxConformanceTest::testCreateSingleValueAlter with data set #9 ('ContributionRecur')
api result array comparison failed checking if contact_id was correctly updated
Array
(
[update-params] => Array
(
[id] => 40
[contact_id] => 1730

@mattwire mattwire force-pushed the contributionrecurmodifieddate branch from fc34c4d to 6a53beb Compare September 23, 2021 10:22
@mattwire
Copy link
Contributor Author

@eileenmcnaughton The issue with the test is the API3 ContributionRecur.get - returnParams need to ignore contribution_recur_modified_date when the default is to ignore modified_date only.

@mattwire mattwire force-pushed the contributionrecurmodifieddate branch from 6a53beb to b178252 Compare September 23, 2021 10:23
@@ -1 +1,3 @@
{* file to handle db changes in 5.43.alpha1 during upgrade *}

ALTER TABLE civicrm_contribution_recur MODIFY COLUMN modified_date DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Last updated date for this record. mostly the last time a payment was received';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattwire just wondering should this be timestamp not datetime? I note it currently is a datetime I think but for modified date should we change to timestamp here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be one of those ones where we made it datetime because of earlier mysql having limits around timestamp. I agreed with Timestamp being the right format

@seamuslee001
Copy link
Contributor

I just have one question around the column type but apart from that this is mergeable adding merge ready

@seamuslee001 seamuslee001 added the merge ready PR will be merged after a few days if there are no objections label Sep 24, 2021
@mattwire mattwire force-pushed the contributionrecurmodifieddate branch from b178252 to 8afede6 Compare September 24, 2021 09:55
@mattwire
Copy link
Contributor Author

@seamuslee001 @eileenmcnaughton I've updated to convert to timestamp. There are various other date fields which are datetime on civicrm_contribution_recur - I don't know if we should be converting those too?

@@ -144,7 +144,7 @@
<name>modified_date</name>
<title>Modified Date</title>
<type>datetime</type>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this need to change too ^^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.. fixed

@mattwire mattwire force-pushed the contributionrecurmodifieddate branch from 8afede6 to a18049c Compare September 24, 2021 13:12
@eileenmcnaughton
Copy link
Contributor

@seamuslee001 @eileenmcnaughton I've updated to convert to timestamp. There are various other date fields which are datetime on civicrm_contribution_recur - I don't know if we should be converting those too?

In the case of 'created_date' I think it's a straight forward yes.

For the other fields I feel like they ideally would be timestamps but I don't know if converting them has any implications - especially with regards to 'next scheduled date'

@demeritcowboy
Copy link
Contributor

This is conflicted now.

@mattwire mattwire force-pushed the contributionrecurmodifieddate branch from a18049c to 38b8dbf Compare September 29, 2021 12:05
@mattwire
Copy link
Contributor Author

@demeritcowboy resolved conflicts

@demeritcowboy demeritcowboy merged commit 262957a into civicrm:master Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections ok-without-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants