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

[4.0] Fix update to 4.0-beta1-dev failing with SQL error when updating from 3.9 or 3.10 with testing sample data #27228

Conversation

richard67
Copy link
Member

@richard67 richard67 commented Dec 8, 2019

Pull Request for Issue #27032 (comment).

See also #27032 (comment).

Summary of Changes

On J 3.9 and 3.10, the column core_checked_out_time of database table #__ucm_content has data type varchar(255) and not datetime like it should be in MySQL databases, see here: https://github.com/joomla/joomla-cms/blob/staging/installation/sql/mysql/joomla.sql#L1883.

On PostgreSQL it already has the right data type timestamp without time zone, see here: https://github.com/joomla/joomla-cms/blob/staging/installation/sql/postgresql/joomla.sql#L1851.

When a current staging or 3.9.x or 3.10 is installed with English testing sampla date, records are added to table #__ucm_content with value '' (empty sting) for column core_checked_out_time on MySQL.

This makes the following SQL statement to convert the database column to datetime data type fail on certain MySQL databases (5.7 and later with default settings, e.g. some strict modes on): https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-08-01.sql#L6.

This PR here adds before the failing statement an update statement which changes an empty string to a sting literal for the (old) MySQL null date, so when converting the column to datetime the string will be converted correctly.

The old null date is then later converted correctly to a real null value here: https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-09-14.sql#L24-L26.

One may say maybe better fix the testing sample data installation, but there might be other sources where empty string values for the core_checked_out_time might come from, and these also would be fixed by this PR here, so it makes sense, and testing sample data might be fixed later independently of this PR.

Testing Instructions

  1. Install staging or 3.9.13 or a current nightly build of 3.10 with English testing sample data.

j3-install-with-testing-sample-data

  1. In backend, go to Global Configuration, tab "Server", and set error reporting to "Maximum" or "Development".

  2. Download the Joomla 4 nightly build update package "Joomla_4.0.0-beta1-dev-Development-Update_Package.zip" from here: https://developer.joomla.org/nightly-builds.html.

  3. Update your installation to 4.0-beta1-dev using the Joomla Update Component's "Upload & Update" tab, uploading the zip package downloaded before in step 3.

  4. At the end of the update, login to the backend.

Result: See section "Actual result" below.

  1. Repeat steps 1 to 5, but in step 3 download following zip package instead of the regular nightly build: https://test5.richard-fath.de/Joomla_4.0.0-beta1-dev-Development-Update_Package_2019-12-08_pr-27228.zip, and in step 4 upload this package instead of the regular one.
    The zip package here is the update package of nightly build of last night plus the change from this PR here applied.

Result: See section "Expected result" below.

Expected result

Update finishs without SQL error.

There might be many untranslated language strings shown, but this is not related to this PR here, it happens also with the regular, i.e. unmodified update package from last nightly build.

Actual result

After the first login to backend after end of the update:

J4-update-from-staging-with-testing-sample-data

But there is no further hint in PHP error log or the MySQL log file about the source of this error.

There might be many untranslated language strings shown, but this is a separate issue not related to the issue handled by this PR here.

Documentation Changes Required

None.

@richard67 richard67 changed the title [4.0] [WiP] Fix update to 4.0-beta1-dev failing with SQL error when updating from 3.9 or 3.10 with testing sample data [4.0] Fix update to 4.0-beta1-dev failing with SQL error when updating from 3.9 or 3.10 with testing sample data Dec 8, 2019
@richard67 richard67 marked this pull request as ready for review December 8, 2019 22:56
@Quy
Copy link
Contributor

Quy commented Dec 9, 2019

I have tested this item ✅ successfully on 7be914e


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

Co-Authored-By: Quy <quy@fluxbb.org>
@alikon
Copy link
Contributor

alikon commented Dec 9, 2019

I have tested this item ✅ successfully on 803a791


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

@alikon
Copy link
Contributor

alikon commented Dec 9, 2019

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Dec 9, 2019
@HLeithner HLeithner merged commit 91e4829 into joomla:4.0-dev Dec 9, 2019
@HLeithner
Copy link
Member

Thanks

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Dec 9, 2019
@HLeithner HLeithner added this to the Joomla 4.0 milestone Dec 9, 2019
@richard67
Copy link
Member Author

Thanks, too.

@richard67 richard67 deleted the 4.0-dev-fix-update-with-testing-sample-data branch December 9, 2019 11:10
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.

None yet

5 participants