From b093fecb6516bb0e5cd54dd29f5d169a168ec1d6 Mon Sep 17 00:00:00 2001 From: demoManito <1430482733@qq.com> Date: Wed, 24 Aug 2022 13:52:42 +0800 Subject: [PATCH] add tablename --- tests/postgres_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/postgres_test.go b/tests/postgres_test.go index e424c452..8f4283cd 100644 --- a/tests/postgres_test.go +++ b/tests/postgres_test.go @@ -84,9 +84,7 @@ func TestMany2ManyWithDefaultValueUUID(t *testing.T) { } DB.Migrator().DropTable(&Post{}, &Category{}, "post_categories") - if err := DB.AutoMigrate(&Post{}, &Category{}).Error(); err != nil { - t.Log(err) - } + DB.AutoMigrate(&Post{}, &Category{}) post := Post{ Title: "Hello World", @@ -96,7 +94,7 @@ func TestMany2ManyWithDefaultValueUUID(t *testing.T) { }, } - if err := DB.Create(&post).Error; err != nil { + if err := DB.Table("posts").Create(&post).Error; err != nil { t.Errorf("Failed, got error: %v", err) } }