Automator fails with MySQL/MariaDB Strict Mode
-
When Automator creates a new automation it does no specify in the query the title (it′s empty yet), ex:
INSERT INTO
wp_automatorwp_automations
(type
,user_id
,sequential
,times_per_user
,times
,status
,date
) VALUES (‘all-users’, 1, ‘0’, ‘1’, ‘0’, ‘inactive’, ‘2023-11-13 00:00:00’)But, the table is defined like this:
CREATE TABLE
wp_automatorwp_automations
(id
bigint(20) NOT NULL AUTO_INCREMENT,title
text NOT NULL,type
text NOT NULL,user_id
bigint(20) NOT NULL,sequential
tinyint(1) NOT NULL DEFAULT 0,times_per_user
int(11) NOT NULL DEFAULT 1,times
int(11) NOT NULL DEFAULT 0,status
varchar(50) NOT NULL,date
datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
PRIMARY KEY (id
),
KEYuser_id
(user_id
)
) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;Title is NOT NULL, So, if you don′t use strict mode you only get a Warning:
1 row(s) affected, 1 warning(s): 1364 Field ‘title’ doesn’t have a default value
But if you are in strict mode (more secure at production servers) you get an error and the automation nevers gets created:
Error Code: 1364. Field ‘title’ doesn’t have a default value
The error is very simple and the consequence is that now i need to change my production server config to continue using Automator (i have a lot of automations), i don′t know when this changed but it′s very easy to fix it, just change the insert adding an empty but not null title.
Someome has a fix for this?
Servers like AWS has Strict Mode by default for example
PS: and you can′t define dates as ‘0000-00-00 00:00:00’ right now on MySQL ??
- The topic ‘Automator fails with MySQL/MariaDB Strict Mode’ is closed to new replies.