Issue Bug Needs Feedback Stale

#105438Setting a foreign key on an TCA-autogenerated SQL column crashes the DB compare tool

S P 10/24/24, 13:00 updated 06/11/26, 07:05

Description

When having an inline field or a select field to another table, it can be useful to declare foreign keys on the relation field (for reeferential integrity, generating SQL relation diagrams or doing ON DELETE/@ON UPDATE@ stuff directly via SQL). When letting the TCA autogenerate the SQL definition it is not possible to declare a foreign key. The DB compare tool will just crash hard. One has to copy the field definition to ext_tables.sql then.

# When letting this field be created by TCA automagic (same SQL defintion) it will crash:
my_field int unsigned DEFAULT NULL,

FOREIGN KEY fk_my_field (my_field) REFERENCES foreign_table (uid)

Note: this bug only affects foreign keys! Normal indexes work just fine on TCA-autogenerated fields!

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Setting a foreign key on an TCA-autogenerated SQL column crashes the DB compare tool Resolves: #105438 Releases: main