? Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
3 Oct 2019

Pull Request for Issue #24535 (part).

Summary of Changes

This PR fixes all datetime columns of the com_templates database table #__template_overrides so there will not be any Invalid value '0000-00-00 00:00:00' for datetime error anymore on MySQL 5.7 or later when strict mode is enabled.

Currently table #__template_overrides only contains 2 datetime columns, created_date and modified_date. created_date will be handled like the createdcolumn of the #__banners table in PR #26372 , i.e. they will get no default value.

The default value is only used when inserting new records without specifying values for that particular column. Not having a default will enforce to insert new records with values for these columns being provided and throw an SQL error if some of these values is not specified, i.e. such errors will not be hidden anymore.

Column modified_date will be changes so it allows null values. This is different to other modified columns of other components but necessary here because the null is used to detect if a component or module or whatever for which an override has been made has been uninstalled meanwhile.

Because the template overrides functionality to which the table belongs to has been added in 4.0, there is no update for any old records in any sql update script, and because we are not in Beta phase yet and so don't have to support updates from 4.0-Alpha-x to 4.0-Alpha-y or between nightly builds, we don't need such update statements.

Therefore it is possible just to change the sql update scripts 4.0.0-2018-07-19.sql` which add the new table, what this PR does.

Testing Instructions

Can be tested by code review, but in addition you can do a test for new installation as follows:

  1. Apply the patch on a clean 4.0-dev branch using git or merging manually, or apply it on an installation of current 4.0-dev using patchtester.
  2. If used patchtester on an existing installation in step 1, delete file configuration.php and delete all Joomla database tables in PhpMyAdmin or PhpPgAdmin (depending on your database type).
  3. Do a new installation, login to backend, confirm the statistics dialog, go to global config and set error reporting to maximum or development in server settings.
  4. Use template overrides as described here in the PR which introduced this functionality: #21851.

Expected result

"Template Overrides" work as well as without this PR. In a MySQL database there are no columns created or modified having value '0000-00-00 00:00:00' in table #__template_overrides, and there is no invalid default value anymore in MySQL >= 5.7 with strict mode on.

Actual result

Same as expected result, but the default value of this database column is invalid in MySQL >= 5.7 with strict mode on.

Documentation Changes Required

Maybe core developer docs and extension developer docs should be updated to encourage them not to use '0000-00-00 00:00:00' on MySQL anymore but use real NULL and not abuse '1970-01-01 00:00:00' on PostgreSQL as a speudo null date anymore and use real NULL values also there.

avatar richard67 richard67 - open - 3 Oct 2019
avatar richard67 richard67 - change - 3 Oct 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Oct 2019
Category SQL Administration com_admin Postgresql Installation Front End Plugins
avatar richard67 richard67 - change - 3 Oct 2019
The description was changed
avatar richard67 richard67 - edited - 3 Oct 2019
avatar richard67 richard67 - change - 3 Oct 2019
The description was changed
avatar richard67 richard67 - edited - 3 Oct 2019
avatar richard67 richard67 - change - 3 Oct 2019
The description was changed
avatar richard67 richard67 - edited - 3 Oct 2019
avatar richard67 richard67 - change - 3 Oct 2019
Title
[4.0] [WiP] [com_templates] Fix default value for not nullable datetime columns
[4.0] [com_templates] Fix default value for not nullable datetime columns
avatar richard67 richard67 - edited - 3 Oct 2019
avatar richard67
richard67 - comment - 3 Oct 2019

Please wait with testing ... I have to fix something.

avatar richard67 richard67 - change - 3 Oct 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 3 Oct 2019
Category SQL Administration com_admin Postgresql Installation Front End Plugins SQL Administration com_admin Postgresql com_templates Installation Front End Plugins
avatar richard67 richard67 - change - 3 Oct 2019
Title
[4.0] [com_templates] Fix default value for not nullable datetime columns
[4.0] [com_templates] Fix datetime columns for template overrides
avatar richard67 richard67 - edited - 3 Oct 2019
avatar richard67 richard67 - change - 3 Oct 2019
The description was changed
avatar richard67 richard67 - edited - 3 Oct 2019
avatar richard67
richard67 - comment - 3 Oct 2019

Ready for testing.

avatar richard67 richard67 - change - 4 Oct 2019
The description was changed
avatar richard67 richard67 - edited - 4 Oct 2019
avatar richard67
richard67 - comment - 4 Oct 2019

Please wait with testing until PR #26464 is merged, or apply that PR and this here together, but that will not work with patchtester because they both touch the same file.

avatar richard67
richard67 - comment - 6 Oct 2019

Now as PR #26464 has been merged, this PR here can be tested as described above in the instructions.

avatar richard67 richard67 - change - 6 Oct 2019
The description was changed
avatar richard67 richard67 - edited - 6 Oct 2019
avatar richard67 richard67 - change - 6 Oct 2019
The description was changed
avatar richard67 richard67 - edited - 6 Oct 2019
avatar wilsonge wilsonge - close - 10 Oct 2019
avatar wilsonge wilsonge - merge - 10 Oct 2019
avatar wilsonge wilsonge - change - 10 Oct 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-10-10 22:18:17
Closed_By wilsonge
avatar wilsonge
wilsonge - comment - 10 Oct 2019

Thanks!

Add a Comment

Login with GitHub to post a comment