fix(postgres): fix creating issue

Signed-off-by: soxx <soxx@fenpa.ws>
This commit is contained in:
SoXX 2024-06-21 17:50:31 +02:00
parent f5360d2757
commit aea99da484

View File

@ -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,