Skip to content

Conversation

SergioAFRTM
Copy link

@SergioAFRTM SergioAFRTM commented Jul 14, 2025

This PR adds a failing test case to reproduce a bug where a self-referential belongs to relationship with a UUID foreign key is incorrectly migrated as bigint instead of uuid for PostgreSQL databases.

The test defines a User struct with the problematic relationship and runs AutoMigrate. The test will fail because the generated DDL has the wrong column type for the foreign key.

This test is for issue #7517 in the main go-gorm/gorm repository.

(Note that SQLite also fails, but I'm not knowlegable enough on SQLite syntax to understand exaclty why)

Added self referential UUID test to Users' model.
Update the dependencies to the latest versions available.
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.

1 participant