Feature: #85160 - Auto create management DB fields from TCA ctrl¶
See forge#85160
Description¶
The database schema analyzer automatically creates TYPO3 "management" related
database columns by reading a tables TCA
and checking the ctrl
section for table capabilities.
Note this affects only basic columns like uid
, deleted
and language
handling related fields like sys_language_uid
, but not a tables main
business fields like a "title" field for a news extension. Those still have to
be defined by extension authors. No column definitions are created from the
columns
section of a tables TCA
.
However, ext_tables.sql
file can be stripped down to business fields.
For example, if a TCA
definition of a table specifies
$GLOBALS['TCA']['myTable']['ctrl']['sortby'] = 'sorting'
,
the core will automatically add the column sorting
with an appropriate
definition.
Field definitions in ext_tables.sql
take precedence over automatically
generated fields, so the core never overrides a manually specified column definition
from an ext_tables.sql
file.
These columns below are automatically added if not defined in ext_tables.sql
for database tables that provide a $GLOBALS['TCA']
definition:
uid
andPRIMARY KEY
If removing the uid field from ext_tables.sql, the
PRIMARY KEY
must be removed, too.pid
andKEY parent
Column pid is
unsigned
if the table is not workspace aware, the default indexparent
includespid
andhidden
as well asdeleted
if the latter two are specified inTCA
ctrl
. The parent index creation is only applied if columnpid
is auto generated, too.['ctrl']['tstamp'] = 'fieldName'
Often set to
tstamp
orupdatedon
['ctrl']['crdate'] = 'fieldName'
Often set to
crdate
orcreatedon
['ctrl']['cruser_id'] = 'fieldName'
Often set to
cruser
orcreatedby
['ctrl']['delete'] = 'fieldName'
Often set to
deleted
['ctrl']['enablecolumns']['disabled'] = 'fieldName'
Often set to
hidden
ordisabled
['ctrl']['enablecolumns']['starttime'] = 'fieldName'
Often set to
starttime
['ctrl']['enablecolumns']['endtime'] = 'fieldName'
Often set to
endtime
['ctrl']['enablecolumns']['fe_group'] = 'fieldName'
Often set to
fe_group
['ctrl']['sortby'] = 'fieldName'
Often set to
sorting
['ctrl']['descriptionColumn'] = 'fieldName'
Often set to
description
['ctrl']['editlock'] = 'fieldName'
Often set to
editlock
['ctrl']['languageField'] = 'fieldName'
Often set to
sys_language_uid
['ctrl']['transOrigPointerField'] = 'fieldName'
Often set to
l10n_parent
['ctrl']['translationSource'] = 'fieldName'
Often set to
l10n_source
l10n_state
Column added if
languageField
andtransOrigPointerField
are set['ctrl']['origUid'] = 'fieldName'
Often set to
t3_origuid
['ctrl']['transOrigDiffSourceField'] = 'fieldName'
Often set to
l10n_diffsource
['ctrl']['versioningWS'] = true
-t3ver_*
columnsColumns that make a table workspace aware. All those fields are prefixed with
t3ver_
, for examplet3ver_oid
andt3ver_id
. A default index namedt3ver_oid
to fieldst3ver_oid
andt3ver_wsid
is added, too.
Impact¶
Extension developers can skip tons of "general" fields from extensions
ext_tables.sql
files.