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

Issue #543: set $expression->lastUpdateDate #544

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

t4k
Copy link
Contributor

@t4k t4k commented Feb 27, 2019

The real changes besides white space include:

  • set $expression->productionUseInd to a string in the else clause
  • avoid rewriting $expression->productionUseInd immediately after the else clause (if it is an update and the value is already set, it would have been always overwritten)
  • set $expression->lastUpdateDate = date('Y-m-d H:i:s'); so that we don't get the cannot be null error

Issue #543

TEST PLAN

Environment (I believe the problem lies in the MySQL configuration):

  • PHP Version 7.0.33-0ubuntu0.16.04.1
  • MySQL Server version: 5.6.40-log Source distribution (AWS RDS)
    • explicit_defaults_for_timestamp set to TRUE
  • Apache/2.4.18 (Ubuntu)

Confirmation of Problem

Without the patch, when trying to add an Expression to a License in the Licensing module, the error There was a problem with the database: Column 'lastUpdateDate' cannot be null is shown and the Expression cannot be saved.

Resolution

With the patch, the lastUpdateDate value is explicitly set so that the DatabaseObject code is not finding no value and trying to set the field to NULL. The Expression should save without any problems.

jeffnm and others added 2 commits February 14, 2019 09:19
The real changes besides white space include:

- set `$expression->productionUseInd` to a string in the `else` clause
- avoid rewriting `$expression->productionUseInd` immediately after the `else` clause (if it is an update and the value is already set, it would have been always overwritten)
- set `$expression->lastUpdateDate = date('Y-m-d H:i:s');` so that we don't get the cannot be null error
@jeffnm
Copy link
Member

jeffnm commented Apr 29, 2019

Hey @t4k, could you suggest a testing plan for this PR?

@t4k
Copy link
Contributor Author

t4k commented May 3, 2019

I found out why this is so difficult to reproduce. It has to do with the explicit_defaults_for_timestamp that is set to TRUE by default on AWS RDS MySQL 5.6.

When this value is set we run into a problem because the code

if ($value == '' || !isset($value)) {
$value = "NULL";

is trying to save a NULL value for the field. Now this would be normally overcome by the schema setting of
`lastUpdateDate` timestamp NOT NULL default CURRENT_TIMESTAMP,

but it seems that the MySQL configuration overrides that schema setting.

I've updated the issue with a test plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants