Skip to content

Conversation

@dan-wilton
Copy link
Contributor

The to_field parameter can be explicitly provided to the django ForeignKey interface, however we were defaulting to always use the pk of the related model.

This has led to a regression where django would think the ForeignKey relationship was operating over the specified to_field, but the database column type was incorrect.

@dan-wilton dan-wilton requested a review from a team as a code owner November 18, 2025 15:37
Copy link

@LilyFirefly LilyFirefly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

The `to_field` parameter can be explicitly provided to the django `ForeignKey` interface, however we
were defaulting to always use the pk of the related model. This led to a regression where django
would think the ForeignKey relationship was operating over the specified `to_field`, but the
database column type was incorrect.
@dan-wilton dan-wilton force-pushed the foreignkeys/bugfix-safer-add-field-foreign-key-explicit-to-field branch from 9ae3966 to ec336d5 Compare November 18, 2025 16:12
@dan-wilton dan-wilton merged commit cb0c8aa into kraken-tech:main Nov 20, 2025
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants