From aea99da4847eb1f1aa21a073bea4f536b2fbe64f Mon Sep 17 00:00:00 2001 From: soxx Date: Fri, 21 Jun 2024 17:50:31 +0200 Subject: [PATCH] fix(postgres): fix creating issue Signed-off-by: soxx --- internal/postgres/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/postgres/user.go b/internal/postgres/user.go index 921af51..10b343c 100644 --- a/internal/postgres/user.go +++ b/internal/postgres/user.go @@ -70,7 +70,7 @@ func CreateUserNodeWithSourceRelation(ctx context.Context, db *gorm.DB, anthrove AccountID: userID, } - if err := db.WithContext(ctx).Create(&userSource).Error; err != nil { + if err := db.WithContext(ctx).FirstOrCreate(&userSource).Error; err != nil { log.WithFields(log.Fields{ "anthrove_user_id": anthroveUserID, "source_domain": sourceDomain,