Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoMigrate fails if custom index is already added to the table (Duplicate column error) #5282

glebarez opened this issue Apr 21, 2022 · 2 comments
type:with reproduction steps


Copy link

@glebarez glebarez commented Apr 21, 2022

GORM Playground Link



AutoMigrate fails if custom index is already added to the table (Duplicate column error)

Copy link
Contributor Author

@glebarez glebarez commented Apr 21, 2022

This is due to SQLite driver does not expect index name in CREATE INDEX to be written without any quotes.
Fix PR opened: go-gorm/sqlite#90

The misleading error duplicate column name: id was due to bug in GORM migrator (Fix filed in #5283)

Copy link

@LouisSayers LouisSayers commented Apr 22, 2022

Not just a Sqlite issue, I just got this in postgres as well with the latest gorm and postgres driver versions

I'm getting errors that look like:
relation "idx_signup_requests_hash_code" already exists (SQLSTATE 42P07)

With Versions: v1.23.4 v1.3.4

Have had issues with this for a number of weeks now and having to do some hacky stuff to get migrations working...

jinzhu pushed a commit to go-gorm/sqlite that referenced this issue Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
type:with reproduction steps
None yet

No branches or pull requests

3 participants