[BUGFIX] Respect TCA "check" default for auto-create DB fields
Change #101653 introduced the auto-creation of DB fields for TCA type "check", but used a hardcoded "0" as default. Since TCA definitions might define a different default, and records may not always be created using the DataHandler to respect TCA defaults, this can lead to DB entries getting created with an unexpected default setting. IMPORTANT: This patch only fixes the root cause of the bug. If an existing v13 installation has already created new records after the DB migration wizard update in 13.0, all records may have wrong defaults. Check the contents of your database for the fields listed below and apply manual adjustments as needed (for example, record storages having "auto_extract_metadata"=1 instead of 0). An example symptom of this is the auto-creation of a file storage record, which uses the QueryBuilder to create a record, without specifying the whole list of all possible fields. For example then leading to added YouTube media files not auto-creating metadata records. This patch uses the proper evaluation of the TCA "default" setting of an auto-created field. In TYPO3 Core this only affected `be_users.options` and `sys_file_storage.auto_extract_metadata` default record creation. The latter field has now been included to the default record creation as a fixed value like the others. A follow-up patch could rewrite this functionality using the DataHandler or QueryBuilder default value injection. Tests have been created to verify this regression, existing tests for be_user creation have been adapted for the proper default values. Executing the DB schema analyzer will now adjust the following fields: * be_users.options (0->3) * sys_file_storage.is_browsable (0->1) * sys_file_storage.is_writable (0->1) * sys_file_storage.is_online (0->1) * sys_file_storage.auto_extract_metadata (0->1) * sys_file_metadata.visible (0->1) * tt_content.sectionIndex (0->1) * tx_styleguide_palette.palette_1_1 (0->1) * tx_styleguide_palette.palette_1_3 (0->1) * tx_styleguide_valuesdefault.checkbox_1 (0->1) * tx_styleguide_valuesdefault.checkbox_2 (0->1) * tx_styleguide_valuesdefault.checkbox_3 (0->5) * tx_styleguide_valuesdefault.checkbox_4 (0->5) * sys_workspace.edit_allow_notificaton_settings (0->3) * sys_workspace.edit_notification_preselection (0->2) * sys_workspace.publish_allow_notificaton_settings (0->3) * sys_workspace.publish_notification_preselection (0->1) * sys_workspace.execute_allow_notificaton_settings (0->3) * sys_workspace.execute_notification_preselection (0->3) * sys_workspace_stage.allow_notificaton_settings (0->3) * sys_workspace_stage.notification_preselection (0->8) Resolves: #103915 Related: #101653 Releases: main Change-Id: Ia42e00b03d1369efe319e41e2b406b5303804854 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84402 Tested-by:Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by:
Oliver Wand <wand@itaw.de> Tested-by:
core-ci <typo3@b13.com>
Showing
- typo3/sysext/backend/Tests/Functional/Command/Fixtures/Expected/be_users_after_admin.csv 1 addition, 1 deletion...tional/Command/Fixtures/Expected/be_users_after_admin.csv
- typo3/sysext/backend/Tests/Functional/Command/Fixtures/Expected/be_users_after_maint.csv 1 addition, 1 deletion...tional/Command/Fixtures/Expected/be_users_after_maint.csv
- typo3/sysext/backend/Tests/Functional/Command/Fixtures/Expected/be_users_after_normal.csv 1 addition, 1 deletion...ional/Command/Fixtures/Expected/be_users_after_normal.csv
- typo3/sysext/core/Classes/Database/Schema/DefaultTcaSchema.php 1 addition, 1 deletion.../sysext/core/Classes/Database/Schema/DefaultTcaSchema.php
- typo3/sysext/core/Classes/Resource/StorageRepository.php 1 addition, 0 deletionstypo3/sysext/core/Classes/Resource/StorageRepository.php
- typo3/sysext/core/Documentation/Changelog/13.2/Important-103915-AutoDBCreationForTCATypeCheck.rst 89 additions, 0 deletions...g/13.2/Important-103915-AutoDBCreationForTCATypeCheck.rst
- typo3/sysext/core/Tests/Unit/Database/Schema/DefaultTcaSchemaTest.php 73 additions, 0 deletions.../core/Tests/Unit/Database/Schema/DefaultTcaSchemaTest.php
Please register or sign in to comment