0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Go言語でマイグレーションしたらエラーが出た

Posted at

実行環境:mac

モデル、マイグレートファイルを作成後「GO_ENV=dev go run migrate/migrate.go」のコマンド実行でエラーが出ました。

watashinomac-Pro-go-study % GO_ENV=dev go run migrate/migrate.go 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)

調べたところ、driver/postgres@v1.5.5のドライバーのバージョンを下げればいいとのこと。

go.modの
gorm.io/driver/postgres v1.5.5gorm.io/driver/postgres v1.5.4
と修正し再度実行したところマイグレートができました!

参考
【Golang】人のビルドプロセス見て我が振り直せ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?