Skip to content

Conversation

nowindexman
Copy link

image If a field in a database table uses the serializer tag and AutoMigrate is used, then even if there are no changes to this field,AutoMigrate will still perform an ALTER on the table every time. image The reason is that during the AutoMigrate comparison, the default value read from the database does not match the default value bound by GORM. The dv variable is read from the database, while field.DefaultValue is obtained by GORM after reading the struct. field.DefaultValue includes an extra layer of single quotes (''), causing the values to not match.

… and AutoMigrate is used, then even if there are no changes to this field, AutoMigrate will still perform an ALTER on the table every time.]
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