CodersCare / l10nmgr

GNU General Public License v3.0
0 stars 9 forks source link

Missing unique / primary key on the table - `sys_language_l10nmgr_language_restricted_record_mm` #41

Open 0xff8 opened 7 months ago

0xff8 commented 7 months ago

Hi everyone,

There is a table sys_language_l10nmgr_language_restricted_record_mm without a primary/unique key and such tables are not supported by mysql group replication. Could I ask you, devs, add/change (whatever you think is better) the table definition to create missing unique index?

currently, the table structure is:

CREATE TABLE `sys_language_l10nmgr_language_restricted_record_mm` (
  `uid_local` int(11) NOT NULL DEFAULT '0',
  `uid_foreign` int(11) NOT NULL DEFAULT '0',
  `tablenames` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `fieldname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `sorting` int(11) NOT NULL DEFAULT '0',
  `sorting_foreign` int(11) NOT NULL DEFAULT '0',
  KEY `uid_local_foreign` (`uid_local`,`uid_foreign`),
  KEY `uid_foreign_tablefield` (`uid_foreign`,`tablenames`(40),`fieldname`(3),`sorting_foreign`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Bunnyfield commented 7 months ago

This seems to be a problem of any usual MM table in TYPO3 then, since i.e. sys_category_record_mm does not contain a unique key either. We could provide a primary key for the l10nmgr table, but first need to check if this had any impact on how TYPO3 deals with those records.

0xff8 commented 7 months ago

Hi @Bunnyfield , Thank for the response.
I confirm that typo3 table sys_category_record_mm has no unique index. I usually add the missing index by creating it in one of project-related extensions. Do you suggest to do the same for sys_language_l10nmgr_language_restricted_record_mm (if so, what fields should be included in the unique index) ?

I also know , that sys_category_record_mm in typo3 version 12 has a unique index. So, I thought if you are planning to support typo3 v12, may be you could add this index directly in the ext_tables.sql and have it fixed for all versions?

Bunnyfield commented 7 months ago

So it's not about adding a primary key field, but a unique index would be enough?

0xff8 commented 7 months ago

Yes, that shall be enough for mysql group replicaiton. If you could do so , that would be amazing :pray: