Generate DB scheme from TCA
ext_tables.sql and generate the DB scheme solely from the information provided by TCA. This will make the TCA array the source of truth for all DB related information.
Currently the TCA contains the following information:
- Table name
- Relations, including table names for MM tables and related fields
- Partial information about types, allowed values, default values, nullable, etc
Missing but in the
ext_tables.sql file currently:
- Keys, including primary key (usually uid)
- Autoincrement, column length, collate, character set
The structure is open for suggestions.
The former includes all table related information, including keys. The later contains all column related information.
The definitions should stay close to the features provided by the Doctrine scheme service, which is already in use by the core. The configuration keys and values should ideally match directly to the doctrine scheme object properties.
ext_tables.sql will be deprecated and remove in future versions
- Database compare requires reading of TCA files
- Automatic enriching of TCA by definitions from the
ext_tables.sql file (maybe as third party/non-core script or extension)
- One source of truth
- Proper deprecation and migration of DB related constructs (e.g. not matching column definitions) via the already know TCA migration service
- Remove error prone SQL scheme parsing
- Road towards adding constraints to the database
- Migration SQL statements can be added on-the-fly during TCA processing
- Increases TCA files (required for each run of TYPO3)
- Adds more information to TCA instead of reducing it (I have another idea on how to handle this)
- Some developers might do strange stuff with PHP to dynamical change DB related configuration (Already possible with hooks/signals)
- Not easily possible to convert an existing table into TYPO3 extensions/schemes (would required TCA generation anyway)
- Not possible to add non-TYPO3 tables and fields (developers will need to use hooks/signals or create TCA information)
Remarks and notes
The long term goal is to introduce proper database constraints to the TYPO3 SQL scheme automatically. For this to work, we need unified column definitions across tables.
Topic Initiator: Philipp Gampe
Topic Mentor: T.B.A.