Skip to content

Commit

Permalink
Use excluded in DO UPDATE SET
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMasterK committed Jul 28, 2023
1 parent 82aa66e commit 8aefd70
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/main/java/me/kavin/piped/utils/VideoHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ public static void insertVideo(Video video) {
s.createNativeMutationQuery(
"INSERT INTO videos (uploader_id,duration,is_short,thumbnail,title,uploaded,views,id) values " +
"(:uploader_id,:duration,:is_short,:thumbnail,:title,:uploaded,:views,:id) ON CONFLICT (id) DO UPDATE SET " +
"duration = :duration," +
"title = :title," +
"views = :views"
"duration = excluded.duration, title = excluded.title, views = excluded.views"
)
.setParameter("uploader_id", video.getChannel())
.setParameter("duration", video.getDuration())
Expand Down

0 comments on commit 8aefd70

Please sign in to comment.