Invalid default value for 'occurred'

On upgrading from MODX 2.8.3 to MODX 2.8.8 (using the upGradeModx extra)…

Error updating table for class modManagerLog
Array
(
[0] => 42000
[1] => 1067
[2] => Invalid default value for 'occurred'
)

…a couple of weeks ago, I had a similar message when moving a site from one server to another. In the case of the upgrade, I upgraded while running PHP 7.4. Should I upgrade to PHP 8+ before going to MODX 2.8.8?

This seems to be an issue with MySQL and not with PHP.
What version of MySQL are you using?
In your database table modx_manager_log, what is the type and default value of the column “occurred”?

-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Mar 04, 2025 at 02:04 PM
-- Server version: 5.5.65-MariaDB
-- PHP Version: 8.3.15

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";

‘occurred’ is…
Type: datetime
Default: NULL

As far as I can tell there was a change in MODX 2.8.7 that adds a default value of CURRENT_TIMESTAMP to the “occurred” column.

It used to be that such a default value was only possible for a column of type “TIMESTAMP” and it seems that for MariaDB version 5 this is still the case. I believe it was changed in version 10.

So bearing in mind that it seems to me that not all hosts are yet making version 10 available, is there a work-round or another way of setting this that will work for both? Seems a bit strange (with my limited knowledge) that it would be assumed people will be using version 10. Apologies if I’m misunderstanding.

MariaDB 10.0 is ten years old this month. The oldest LTS release of MariaDB still supported is 10.5. It seems reasonable to assume that hosts would be relatively up-to-date on database releases. But if a solution was submitted that would support the strict sql_modes this change was meant to resolve problems with and could still support extremely old releases of MySQL/MariaDB, we would consider merging it for the 2.x branch.

Thank you Jason. I tend to build quite small sites and I’m often stuck with whatever hosting they happen to have in place. I just had a look at a few hosts that I have access to and of three Plesk based hosts I don’t have the option to upgrade (a bit worrying really). With one site on ionos version 10 is the default. It looks like the problem I had last week was actually caused by having to go ‘backwards’ when transferring to the client’s server.