pg support of duplicate key update

This commit is contained in:
xiaomlove
2026-04-25 03:22:38 +07:00
parent dc77ab7b40
commit 7d18a7f76a
14 changed files with 62 additions and 29 deletions
+1 -1
View File
@@ -749,7 +749,7 @@ class TorrentRepository extends BaseRepository
$values[] = sprintf("(%s, %s, '%s', '%s')", $torrentId, $tagId, $time, $time);
}
}
$sql .= implode(', ', $values) . " on duplicate key update updated_at = values(updated_at)";
$sql .= implode(', ', $values) . " " . NexusDB::upsertField(['torrent_id', 'tag_id'], ['updated_at']);
if ($remove) {
TorrentTag::query()->whereIn('torrent_id', $idArr)->delete();
}