[FEATURE] Auto create management DB fields from TCA ctrl 21/57121/45
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 4 Jun 2018 12:13:23 +0000 (14:13 +0200)
committerBenni Mack <benni@typo3.org>
Thu, 7 Jun 2018 14:41:55 +0000 (16:41 +0200)
commit7b2319ffee9766fe8b459a69bf641711d8655ec1
tree953bfad8e163ef3ededbebd4c8d3751fdfed9c2b
parenta3dc2b86114ab24ecf56b30d09d88a72a2dea9de
[FEATURE] Auto create management DB fields from TCA ctrl

Adds a class that auto creates TYPO3 "management" related database
columns and indexes based on TCA 'ctrl' information without having
them specified in ext_tables.sql. The feature .rst file outlines
field details.

Goals:
* Save extension developers time.
* Less copy+paste issues and different general fields definitions.
* Reduce number of boilerplate fields in ext_tables.sql.
* Bring schema of management fields under core control.

Non goals:
* No full substitution of ext_tables.sql by TCA: "Business"
  fields from 'columns' are NOT created automatically. This
  would require further thoughts and code disentangling.
* No new extension API.
* No "migration" approach or similar.

Notable patch details:
* The patch is a revamped version of issue #81234 that has been
  abandoned. As requested in the review of #81234, the code now
  hooks in after ext_tables.sql has been parsed into the doctrine
  schema.
* Field defintions of ext_tables.sql take precedence, auto fields
  are only added if ext_tables.sql does not define a column or index.
  This makes the patch fully backwards compatible.
* No deprecation for obsolete field definitions in ext_tables.sql
  is logged.
* Many core fields are aligned to a central definition and slightly
  change. For instance "uid" is now always an unsigned int.
* Reduce all core's ext_tables.sql files as well as the functional
  testing related ext_tables.sql files down to the business fields
* A relatively huge series of test adaptions: Especially the
  ext:impexp related functionals now create dumps with differently
  sorted fields - This is no problem during import.
* Field t3_origuid of sys_file_reference has never been registered
  in TCA as ['ctrl']['origUid'], is thus unused and removed as obsolete.
* The extension manager no longer applies possible destructive changes,
  it only adds missing columns and tables when loading / updating
  extensions. It however considers *all* ext_tables.sql files, not only
  the one the extension in question provides. See the important .rst
  file for details.

Change-Id: I640a7c7da3b63bac21a71102f253aa2d1bef4391
Resolves: #85160
Related: #81234
Releases: master
Reviewed-on: https://review.typo3.org/57121
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
59 files changed:
typo3/sysext/core/Classes/DataHandling/DatabaseSchemaService.php [deleted file]
typo3/sysext/core/Classes/Database/Schema/DefaultTcaSchema.php [new file with mode: 0644]
typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php
typo3/sysext/core/Documentation/Changelog/master/Feature-85160-AutoCreateManagementDBFieldsFromTCACtrl.rst [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/master/Important-85160-NonDesctructiveDatabaseSchemaChangesInExtensionManager.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Functional/DataHandling/FAL/DataSet/LiveDefaultElements.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/ActionTest.php
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/changeContentSorting.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/copyContent.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/copyContentToLanguage.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/createContentWFileReference.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/deleteContent.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/localizeContent.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/modifyContent.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/modifyContentNAddFileReference.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/modifyContentNDeleteAllFileReference.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/modifyContentNDeleteFileReference.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/modifyContentWFileReference.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/moveContentToDifferentPage.csv
typo3/sysext/core/Tests/Functional/DataHandling/FAL/Modify/DataSet/moveContentToDifferentPageNChangeSorting.csv
typo3/sysext/core/Tests/Functional/Database/Schema/SchemaMigratorTest.php
typo3/sysext/core/Tests/Functional/Fixtures/Extensions/irre_tutorial/ext_tables.sql
typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler/ext_tables.sql
typo3/sysext/core/Tests/Unit/Database/Schema/DefaultTcaSchemaTest.php [new file with mode: 0644]
typo3/sysext/core/ext_localconf.php
typo3/sysext/core/ext_tables.sql
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TCA/tx_blogexample_domain_model_post.php
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/ext_tables.sql
typo3/sysext/extbase/Tests/Functional/Persistence/TranslatedContentTest.php
typo3/sysext/extensionmanager/Classes/Controller/ActionController.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php
typo3/sysext/extensionmanager/ext_tables.sql
typo3/sysext/extensionmanager/ext_tables_static+adt.sql
typo3/sysext/frontend/Tests/Functional/Rendering/DataSet/LiveDefaultElements.csv
typo3/sysext/frontend/ext_tables.sql
typo3/sysext/impexp/Tests/Functional/Fixtures/Extensions/impexp_group_files/ext_tables.sql
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/mysql/impexp-group-file-and-file_reference-item-but-images-not-included.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/mysql/impexp-group-file-and-file_reference-item-in-ff.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/mysql/impexp-group-file-and-file_reference-item.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/mysql/irre-records.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/mysql/pages-and-ttcontent-with-corrupt-image.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/mysql/pages-and-ttcontent-with-image-but-not-included.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/mysql/pages-and-ttcontent-with-image.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/mysql/pages-and-ttcontent.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/postgresql/impexp-group-file-and-file_reference-item-but-images-not-included.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/postgresql/impexp-group-file-and-file_reference-item-in-ff.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/postgresql/impexp-group-file-and-file_reference-item.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/postgresql/irre-records.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/postgresql/pages-and-ttcontent-with-corrupt-image.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/postgresql/pages-and-ttcontent-with-image-but-not-included.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/postgresql/pages-and-ttcontent-with-image.xml
typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/postgresql/pages-and-ttcontent.xml
typo3/sysext/indexed_search/ext_tables.sql
typo3/sysext/redirects/ext_tables.sql
typo3/sysext/scheduler/ext_tables.sql
typo3/sysext/sys_action/ext_tables.sql
typo3/sysext/sys_note/ext_tables.sql
typo3/sysext/workspaces/ext_tables.sql