ext_tables.sql   
            ext_tables.sql
- 
            - Scope
- extension
- Path (Composer)
- packages/my_extension/ext_tables.sql
- Path (Classic)
- typo3conf/ext/my_extension/ext_tables.sql
 The ext_file in the root folder of an extension holds additional SQL definition of database tables.tables. sql This file should contain a table-structure dump of the tables used by the extension which are not auto-generated. It is used for evaluation of the database structure and is applied to the database when an extension is enabled. 
If you add additional fields (or depend on certain fields) to existing tables
you can also put them here. In this case insert a 
        CREATE TABLE structure
for that table, but remove all lines except the ones defining the fields you
need. Here is an example adding a column to the pages table:
CREATE TABLE pages (
    tx_myextension_field int(11) DEFAULT '0' NOT NULL,
);TYPO3 will merge this table definition to the existing table definition when
comparing expected and actual table definitions (for example, via the
Admin Tools > Maintenance > Analyze Database Structure or the
CLI command 
        extension:. Partial
definitions can also contain indexes and other directives. They can also change
existing table fields - but that is not recommended, because it may
create problems with the TYPO3 Core and/or other extensions.
The ext_tables.sql file may not necessarily be "dumpable" directly to
a database (because of the semi-complete table definitions allowed that
define only required fields). But the extension manager or admin tools can
handle this.
TYPO3 parses 
        ext_ files. TYPO3 expects that all
table definitions in this file look like the ones produced by the
        mysqldump utility. Incorrect definitions may not be recognized
by the TYPO3 SQL parser or may lead to SQL errors, when TYPO3 tries
to apply them. If TYPO3 is not running on MySQL or a directly compatible
other DBMS like MariaDB, the system will
parse the file towards the target DBMS like PostgreSQL or SQLite.
Auto-generated structure
The database schema analyzer automatically creates TYPO3 "management"-related
database columns by reading a table's TCA and checking the Table properties (ctrl)
section for table capabilities. Field definitions in ext_tables.sql take
precedence over automatically generated fields, so the TYPO3 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
definition:
- uidand- PRIMARY KEY
- If the uidfield is not provided inside theext_tables.sqlfile, thePRIMARY KEYconstraint must be omitted, too.
- pidand- KEY parent
- The column pidisunsigned, if the table is not workspace-aware, the default indexparentincludespidandhiddenas well asdeleted, if the latter two are specified in TCA's Table properties (ctrl). The parent index creation is only applied, if the columnpidis auto-generated, too.
The following $GLOBALS['TCA']['ctrl'] are considered for
auto-generated fields, if they are not manually defined in the
ext_tables.sql file:
- ['ctrl']- ['tstamp'] = 'my_ - field_ - name' 
- Often set to tstamporupdatedon.
- ['ctrl']- ['crdate'] = 'my_ - field_ - name' 
- Often set to crdateorcreatedon.
- ['ctrl']- ['delete'] = 'my_ - field_ - name' 
- Often set to deleted.
- ['ctrl']- ['enablecolumns'] - ['disabled'] = 'my_ - field_ - name' 
- Often set to hiddenordisabled.
- ['ctrl']- ['enablecolumns'] - ['starttime'] = 'my_ - field_ - name' 
- Often set to starttime.
- ['ctrl']- ['enablecolumns'] - ['endtime'] = 'my_ - field_ - name' 
- Often set to endtime.
- ['ctrl']- ['enablecolumns'] - ['fe_ - group'] = 'my_ - field_ - name' 
- Often set to fe_.group 
- ['ctrl']- ['sortby'] = 'my_ - field_ - name' 
- Often set to sorting.
- ['ctrl']- ['description - Column'] = 'my_ - field_ - name' 
- Often set to description.
- ['ctrl']- ['editlock'] = 'my_ - field_ - name' 
- Often set to editlock.
- ['ctrl']- ['language - Field'] = 'my_ - field_ - name' 
- Often set to sys_.language_ uid 
- ['ctrl']- ['trans - Orig - Pointer - Field'] = 'my_ - field_ - name' 
- Often set to l10n_.parent 
- ['ctrl']- ['translation - Source'] = 'my_ - field_ - name' 
- Often set to l10n_.source 
- l10n_- state 
- Column added if ['ctrl']and['language Field'] ['ctrl']are set.['trans Orig Pointer Field'] 
- ['ctrl']- ['orig - Uid'] = 'my_ - field_ - name' 
- Often set to t3_.origuid 
- ['ctrl']- ['trans - Orig - Diff - Source - Field'] = 'my_ - field_ - name' 
- Often set to l10n_.diffsource 
- ['ctrl']and- ['versioning - WS'] = true - t3ver_*columns
- Columns that make a table workspace-aware. All
those fields are prefixed with t3ver_, for examplet3ver_. A default index namedoid t3ver_to fieldsoid t3ver_andoid t3ver_is added, too.wsid 
The configuration in $GLOBALS['TCA'][$table]['columns'][$field]['config']['MM'] is considered for auto-generating the intermediate table and fields for:
The following types configured via
$GLOBALS['TCA'][$table]['columns'][$field]['config']
are considered for auto-generated fields, if they are not manually defined in
the ext_tables.sql file:
- TCA type "category" (since TYPO3 v12.0)
- TCA type "datetime"
- TCA type "json"
- TCA type "slug" (since TYPO3 v12.0)
- TCA type "uuid"