Consider the following schema:
type User {
ID string `gorm:"primary_key"`
Name string `gorm:"unique"`
}
Note that no explicit default value was set for a user's name column.
Moreover, consider the following part of the auto migration functionality:
https://github.com/go-gorm/gorm/blob/19b8d37ae8155667d76021e4ca3314bb571756be/migrator/migrator.go#L451-L456
field.DefaultValue is always "", however, columnType.DefaultValue() returns "NULL" on MariaDB and "" on MySQL, as a consequence of which an ALTER TABLE query will be issued on MariaDB although nothing had actually changed. In combination with https://github.com/go-gorm/mysql/issues/74 and the fact that only 64 keys per table are allowed on MariaDB, this can cause a program to crash over time.
A similar issue was already brought up in https://github.com/go-gorm/gorm/issues/5188, I think.
Comment From: github-actions[bot]
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨