NPM Resource Changed ? Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
1 Aug 2019

This hopefully changes all datetime values for com_content from the pseudo-null-date 0000-00-00 00:00:00 to a real null value.

avatar Hackwar Hackwar - open - 1 Aug 2019
avatar Hackwar Hackwar - change - 1 Aug 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Aug 2019
Category SQL Administration com_admin Postgresql com_content JavaScript Repository NPM Change Front End Installation Libraries Modules Plugins
avatar richard67
richard67 - comment - 1 Aug 2019

@Hackwar I don't think the database schema checker/fixer understands this in the schema update for MySQL:

ALTER TABLE #__content
MODIFY created DATETIME NULL DEFAULT NULL,
MODIFY modified DATETIME NULL DEFAULT NULL,
MODIFY publish_up DATETIME NULL DEFAULT NULL,
MODIFY publish_down DATETIME NULL DEFAULT NULL;

I think it needs a single line statement for each column for the database schema checker/fixer:

ALTER TABLE #__content MODIFY created DATETIME NULL DEFAULT NULL;
ALTER TABLE #__content MODIFY modified DATETIME NULL DEFAULT NULL;
ALTER TABLE #__content MODIFY publish_up DATETIME NULL DEFAULT NULL;
ALTER TABLE #__content MODIFY publish_down DATETIME NULL DEFAULT NULL;

You could see that here:

https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Schema/ChangeItem/MysqlChangeItem.php#L149-L175

avatar richard67
richard67 - comment - 1 Aug 2019

@Hackwar Regarding my comment above: I mean that the database checker will only check the first column modification if you have all in 1 alter table statement. But when the check shows for the first column that the statement has not run yet, it will run the complete statement.

So it is formally not correct to have all in 1 statement.

On the other hand, it might be necessary that we do it like this in MySQL 8, and maybe also lower, if strict mode is on. I noticed on MySQL 8 that when running such statement for a single column in PhpMyAdmin on MySQL8, I get an SQL error complaining about the other column not having a valid default value.

If it turns out we have to do that and so betray the database checker a bit (but it would work), then we have to do that everywhere where this change for real null columns has been made already, because I've seen in schema updates of those PR that they did it like I suggested, with 1 alter table statement for every column.

avatar richard67
richard67 - comment - 1 Aug 2019

@Hackwar When running in PhpMyAdmin on MySQL 5.7 with strict mode on, I even have to add the checked_out_time column to make it work, and I have to do all with 1 statement:

ALTER TABLE #__content
MODIFY created DATETIME NULL DEFAULT NULL,
MODIFY modified DATETIME NULL DEFAULT NULL,
MODIFY checked_out_time DATETIME NULL DEFAULT NULL,
MODIFY publish_up DATETIME NULL DEFAULT NULL,
MODIFY publish_down DATETIME NULL DEFAULT NULL;

avatar richard67
richard67 - comment - 1 Aug 2019

@Hackwar I've just tested, it needs 1 statement for each column. I will make PR against your repo.

Question is: Don't you want to do the checked_out_time here, too, and close the other PR which does checked_out_time for all?

avatar Hackwar Hackwar - change - 1 Aug 2019
Labels Added: NPM Resource Changed ?
avatar Hackwar
Hackwar - comment - 1 Aug 2019

I'm going to change the ISNULL to IS NULL and see where the issue in the install SQL is. I would keep the original PR for checked_out and simply provide PRs for everything else and then we can merge everything.

avatar Hackwar
Hackwar - comment - 1 Aug 2019

I will of course do the getNullDateTime() call.

avatar richard67
richard67 - comment - 1 Aug 2019

Which issue in the install SQL?

avatar Quy Quy - change - 14 Oct 2019
Closed_Date 2019-10-14 18:09:55 2019-10-14 18:09:56
avatar Quy Quy - close - 14 Oct 2019
avatar Quy Quy - change - 14 Oct 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-10-14 18:09:55
Closed_By Quy
avatar Quy
Quy - comment - 14 Oct 2019

Replaced by #26295.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25760.

avatar richard67
richard67 - comment - 14 Oct 2019

@Quy Same for PR #25715 , will be replaced by #26491 and #26490 .

Add a Comment

Login with GitHub to post a comment