From 2d534b5f26c1e3a709d98e0c1101e18f6ee20ccc Mon Sep 17 00:00:00 2001 From: Trim21 Date: Fri, 11 Oct 2024 03:16:09 +0800 Subject: [PATCH] fix: ignore episode record exists --- internal/collections/infra/mysql_repo.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/collections/infra/mysql_repo.go b/internal/collections/infra/mysql_repo.go index b1cd567e..a408e44c 100644 --- a/internal/collections/infra/mysql_repo.go +++ b/internal/collections/infra/mysql_repo.go @@ -880,7 +880,8 @@ func (r mysqlRepo) createEpisodeCollection( } table := r.q.EpCollection - err = table.WithContext(ctx).Where(table.UserID.Eq(userID), table.SubjectID.Eq(subjectID)).Create(&dao.EpCollection{ + err = table.WithContext(ctx).Clauses(clause.OnConflict{DoNothing: true}). + Where(table.UserID.Eq(userID), table.SubjectID.Eq(subjectID)).Create(&dao.EpCollection{ UserID: userID, SubjectID: subjectID, Status: bytes,