mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Fix video update on conflict insert
This commit is contained in:
parent
f4040772a2
commit
88e38bd8a1
1 changed files with 7 additions and 2 deletions
|
@ -159,8 +159,13 @@ public class VideoHelpers {
|
|||
try (StatelessSession s = DatabaseSessionFactory.createStatelessSession()) {
|
||||
var tr = s.beginTransaction();
|
||||
try {
|
||||
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 DO NOTHING")
|
||||
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"
|
||||
)
|
||||
.setParameter("uploader_id", video.getChannel())
|
||||
.setParameter("duration", video.getDuration())
|
||||
.setParameter("is_short", video.isShort())
|
||||
|
|
Loading…
Reference in a new issue