go-gorm / gorm

The fantastic ORM library for Golang, aims to be developer friendly
https://gorm.io
MIT License
36.91k stars 3.93k forks source link

Error in GORM migration: GuessConstraintInterfaceAndTable undefined #6821

Closed kazimovzaman2 closed 9 months ago

kazimovzaman2 commented 9 months ago

When attempting to run my Go application with GORM using the PostgreSQL driver, I encountered the following error:

# gorm.io/driver/postgres
../../../go/pkg/mod/gorm.io/driver/postgres@v1.5.5/migrator.go:411:26: m.GuessConstraintInterfaceAndTable undefined (type Migrator has no field or method GuessConstraintInterfaceAndTable)

Steps to Reproduce:

  1. I'm using GORM v1.5.5 with the PostgreSQL driver.
  2. Running the application with the command go run main.go triggers the issue.

I expect the application to run without any errors related to the GuessConstraintInterfaceAndTable method.

github-actions[bot] commented 9 months ago

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.ioSearch Before Asking

mi6e4ka commented 9 months ago

Hello, I managed to solve the problem by rolling back to the postgres driver version 1.5.4, since 1.5.5 is broken and has already been removed from github pr https://github.com/go-gorm/postgres/pull/195

dereksangshi2000 commented 9 months ago

Got the same error. Go version: 1.21.6 OS: mac (arm64)

gorm.io/driver/postgres v1.5.5 // indirect gorm.io/gorm v1.25.6 // indirect

m.GuessConstraintInterfaceAndTable undefined (type Migrator has no field or method GuessConstraintInterfaceAndTable)

BTW, Thanks @mi6e4ka for finding the reason.

github-actions[bot] commented 9 months ago

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.ioSearch Before Asking

jasonchuan commented 9 months ago

Hello, I managed to solve the problem by rolling back to the postgres driver version 1.5.4, since 1.5.5 is broken and has already been removed from github pr go-gorm/postgres#195

I resotre it

github-actions[bot] commented 9 months ago

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.ioSearch Before Asking

iTanken commented 9 months ago

https://github.com/go-gorm/postgres/issues/247#issuecomment-1928676433

https://go.dev/ref/mod#go-mod-file-exclude

require (
    gorm.io/driver/postgres v1.5.4
)

exclude gorm.io/driver/postgres v1.5.5 // This release is a breaking change
github-actions[bot] commented 9 months ago

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.ioSearch Before Asking

black-06 commented 9 months ago

We have released v1.5.6 and retracted v1.5.5