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

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

Comments

@glebarez
Copy link
Contributor

@glebarez glebarez commented Apr 21, 2022

GORM Playground Link

go-gorm/playground#469

Description

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

@glebarez
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)

@LouisSayers
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:
gorm.io/gorm v1.23.4
gorm.io/driver/postgres 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
Labels
type:with reproduction steps
Projects
None yet
Development

No branches or pull requests

3 participants