Feature: #95061 - Auto creation of MM tables from TCA
See forge#95061
Description
TCA table column fields that define ['config']
can omit specification of the
intermediate mm table layout in ext_
. The TYPO3 database analyzer
takes care of proper schema definition.
This feature has been implemented to simplify developers life and to enable the TYPO3 core to handle those schema details since many extensions tend to specify incomplete or broken mm table schema definitions when dealing with this complex area.
Extensions are strongly encouraged to drop ext_
CREATE TABLE
definitions for those intermediate tables referenced by TCA
table columns. Dropping
these definitions allows the core to adapt and migrate definitions if needed.
Impact
Extension developers don't need to deal with ext_
definitions of
"mm" tables anymore. The TYPO3 schema analyzer creates the intermediate schema depending
on TCA
field definition. The schema analyzer tries to apply default specifications
if possible. Single ext_
definitions take precedence, though.
In practice, suppose the "local" side of a mm table is defined as such in TCA:
...
'columns' => [
...
'myField' => [
'label' => 'myField',
'config' => [
'type' => 'group',
'foreign_table' => 'tx_myextension_myfield_child',
'MM' => 'tx_myextension_myfield_mm',
]
],
...
],
...
Until now, a schema definition similar to this had to be in place in ext_
:
CREATE TABLE tx_myextension_myfield_mm (
uid_local int(11) DEFAULT '0' NOT NULL,
uid_foreign int(11) DEFAULT '0' NOT NULL,
sorting int(11) DEFAULT '0' NOT NULL,
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);
This section can and should be dropped. Indicators a schema definition is affected by this:
- A table column TCA config defines
MM
withtype='select'
,type='group'
ortype='inline'
. - The "MM" intermediate table has no TCA table definition (!).
ext_
specifies a table with fieldstables. sql uid_
andlocal uid_
.foreign
The schema analyzer takes care of further possible fields apart from uid_
and
uid_
, like sorting
, sorting_
, tablenames
,
fieldname
and uid
if necessary, depending on "local" side of the TCA definition.
In general, in case an extension got that definition right up until now, the schema analyzer
should not drop or add any additional fields automatically when removing these sections from
ext_
. Developers are strongly encouraged to drop affected CREATE TABLE
definitions from ext_
and to verify the install tool schema migrator acts as
expected. The core takes care of these specifications from now on and may add adaptions or migrations
to streamline further details in the future.