Files
homarr/packages
Thomas Camlong 09c56002d6 fix(db): name the custom widget secret foreign key within mysql limits
drizzle derives `custom_widget_secret_definition_id_custom_widget_definition_id_fk`,
which is 65 characters. MySQL caps identifiers at 64 and rejects it with
error 1059, so migration 0040 created the key under a shortened name. The
schema never declared that name, so every `migration:mysql:generate` run
re-proposed dropping and recreating the key under the long one, producing a
migration that cannot be applied.

Declaring the shortened name explicitly makes the schema match what is
actually in the database. Only the mysql schema changes; sqlite and
postgresql keep their derived names and need no migration.

The parity test matched keys across dialects by generated name, which no
longer holds, so it now matches on what a key links - its columns, target
table and target columns - and compares the referential actions. That also
means it reads keys through getTableConfig and so covers table-level
declarations, not just inline .references() ones.

Adds a guard test asserting no mysql table, foreign key or index name
exceeds 64 characters, so the next long pairing fails in CI instead of
producing an unappliable migration.
2026-08-07 18:14:23 +02:00
..