MutationDigitale / craft3-translate

Craft CMS plugin for static translations in CP
Other
12 stars 7 forks source link

Error Installing when MySQL config: sql_require_primary_key is true. #60

Closed adrianjean closed 7 months ago

adrianjean commented 7 months ago

Hello,

While installing this plugin on a new server setup, I received this error from the installer:


Migration Error: An error occurred while executing the "mutation\translate\migrations\Install migration: SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.
The SQL being executed was: CREATE TABLE message (
id int(11) NOT NULL,
dateCreated datetime(0) NOT NULL,
dateUpdated datetime(0) NOT NULL,
uid char(36) NOT NULL DEFAULT '0',
language varchar(16) NOT NULL,
translation text
) CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB

The key part being:

Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.

I use a DigitalOcean Managed Database and can request that they manually set sql_require_primary_key to false so I can install this plugin, but this apparently has other implications with respect to replication, performance, etc.

At one point it seems CraftCMS core had this same issue and it was resolved in a fix in version 4.2.5 (Link)

Any chance you could also apply a similar fix?

smcyr commented 7 months ago

I fixed the error the same as CraftCMS in version 3.2.1. Let me know if it doesn't work for you. Thanks