Review main Ready for review Quiet

96377[BUGFIX] Auto-create inline foreign_sortby column

Georg Ringer CR +1 V +1 Normal +69 −0 updated 11/06/26, 00:59

Commit message

DefaultTcaSchema already adds the foreign_field and foreign_table_field
columns of an inline relation to the child table if they are neither
defined in TCA nor in ext_tables.sql. The field configured as
foreign_sortby was missing, which led to a database error when saving
the parent record.

The sorting column is now created the same way.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 2
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/77/96377/2 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/77/96377/2 && git cherry-pick FETCH_HEAD

Review

  • Code review CR +1 Needs a vote
    • Markus Klein +1
    • Simon Schaufelberger +1
  • Verified V +1 Needs a vote
    • Markus Klein +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Merge conflicts 4

Issues 1

Files 2

Review log 1012

  1. Georg Ringer uploaded patch set 1 10/05/26, 21:03

  2. Georg Ringer commented on patch set 1 CR +1 V +1 10/05/26, 21:04

    This change is ready for review.
  3. core-ci voted on patch set 1 V +1 10/05/26, 21:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110156

  4. Simon Schaufelberger commented on patch set 1 10/05/26, 23:56

    DefaultTcaSchema.php:900

    why false? foreign keys should not be negative numbers imo
  5. Mathias Brodala commented on patch set 1 10/06/26, 07:09

    DefaultTcaSchemaTest.php:2660

    Just from reading this test does not really verify the "skip column if defined on the foreign table already". The result will be the same if you drop either the local side or the foreign side from the test. AFAIS the actual test should be verifying that no "ColumnAlreadyExists" exception is thrown.
  6. Georg Ringer uploaded patch set 2 CR +1 V +1 11/03/26, 19:42

  7. Georg Ringer commented on patch set 2 11/03/26, 19:43

    DefaultTcaSchema.php:900 Reply

    This is a sorting value, not a foreign key. It matches the auto-created ctrl.sortby column, which is signed as well. The ID columns (foreign_field) above are unsigned

    DefaultTcaSchemaTest.php:2660 Reply

    the test now predefines bSorting as BIGINT on the child table and asserts it is left untouched. Without the isColumnDefinedForTable() check it fails with ColumnAlreadyExists.
  8. Georg Ringer commented on patch set 2 11/03/26, 19:43

    DefaultTcaSchema.php:900 Reply

    Done

    DefaultTcaSchemaTest.php:2660 Reply

    Done
  9. core-ci voted on patch set 2 V +1 11/03/26, 19:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113213

  10. Markus Klein commented on patch set 2 11/03/26, 20:03

    DefaultTcaSchema.php:900 Reply

    Since I was about to write the same comment: I think this is a mistake, also for the sortby.
  11. Markus Klein voted on patch set 2 CR +1 V +1 11/03/26, 20:04

  12. Simon Schaufelberger voted on patch set 2 CR +1 V +1 11/06/26, 00:59