-
-
Notifications
You must be signed in to change notification settings - Fork 529
Fix the query that is generated to purge the old installed extras #16717
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
Conversation
The question here is: Is it safe to assume that the saved |
I believe you are right—the null check needs to be added to the existing criteria rather than replacing it. |
I have checked that first before b9b533b but that did not work on at least two installations. Or did I make a mistake in my query? |
I think the query was incorrect. The string '0000-00-00 00:00:00" is not the same as 0. |
The first check was |
Ohhh… well, that is a huge problem then. I was afraid of that. |
Hmmm, according to the mysql documentation:
So, when you ran the query with both criteria, was it a warning or error you were seeing? |
The server has the following MySQL 8.0.22 sql_mode set:
The same sql_mode don't show that issue in MySQL 5.7.44. The errror message according to SequelPro is: |
Yeah, I was just playing with this after changing the mode and got the error as well. Interesting that behavior is not consistent with what the docs say. It seems to me that the bottom line here is that if someone has these strict date modes enabled in mysql 8+ and there are any zeroish values hanging around in the I think we need to consider changing how dates are stored (to unix timestamp) when they can be initially empty or set back to empty (null), as dealing with this sql mode is a PITA. |
It is possible with an intermediate value (which normally does not occur in the table):
|
Ahh, nice! Just ran that (didn't need the ALTER line, because in 3.x that's already the default config for that column) on my dev install. Works. Maybe this should make it into an upgrade script for the next release? |
Yes. We should review other tables that may have similar issues, as well. |
I have used a similar query for repairing the system/context/user settings in some old installations. |
### What does it do? Converts any invalid dates in the modTransportPackage.installed column to NULL. ### Why is it needed? Empty dates should have been saved as NULL in the column and their presence can cause errors when NO_ZERO_DATE/NO_ZERO_IN_DATE sql_modes are enabled in an environment. ### How to test In an environment with NO_ZERO_DATE/NO_ZERO_DATE sql_modes enabled, build the transport and run the upgrade process, confirming that the process completes and that any invalid dates in the modTransportPackage.installed column are now NULL. You will need to have invalid dates in that column before enabling the strict sql_modes if you want to verify that this works properly. ### Related issue(s)/PR(s) Required for #16717 to be merged.
What does it do?
Fix incorrect DATETIME value: '0000-00-00 00:00:00' error in the query
Why is it needed?
The generated query is wrong for MySQL installations that have NO_ZERO_DATE/NO_ZERO_IN_DATE activated.
Related issue(s)/PR(s)
MODX 3.x port of #16716