From 012ed817744e23a5575bb97f539e878155b8ebce Mon Sep 17 00:00:00 2001
From: Valentins Paramonovs
<5235166+ValentinsParamonovs@users.noreply.github.com>
Date: Wed, 8 Jan 2025 14:12:05 +0200
Subject: [PATCH] fix: playlists videos removal for PostgreSQL (#835)
* Fix playlists videos removal for PostgreSQL
Fixes the constraint violation error upon removing a video from a playlist with PostgreSQL
Resolves TeamPiped/Piped#2814
* Replace comment
* Show responses for the requests in api-test.sh
* Revert "Show responses for the requests in api-test.sh"
This reverts commit 29f6447fec1443043d2cd7ecf2c623bc3fa33bea.
---
.../resources/changelog/db.changelog-master.xml | 1 +
.../2-fix-playlist-reordering-in-postgresql.xml | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
create mode 100644 src/main/resources/changelog/version/2-fix-playlist-reordering-in-postgresql.xml
diff --git a/src/main/resources/changelog/db.changelog-master.xml b/src/main/resources/changelog/db.changelog-master.xml
index 4d3a056..6580a75 100644
--- a/src/main/resources/changelog/db.changelog-master.xml
+++ b/src/main/resources/changelog/db.changelog-master.xml
@@ -6,4 +6,5 @@
+
diff --git a/src/main/resources/changelog/version/2-fix-playlist-reordering-in-postgresql.xml b/src/main/resources/changelog/version/2-fix-playlist-reordering-in-postgresql.xml
new file mode 100644
index 0000000..e01b2d1
--- /dev/null
+++ b/src/main/resources/changelog/version/2-fix-playlist-reordering-in-postgresql.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ ALTER TABLE playlists_videos_ids DROP CONSTRAINT playlists_videos_ids_pkey;
+ ALTER TABLE playlists_videos_ids ADD CONSTRAINT playlists_videos_ids_pkey PRIMARY KEY (playlist_id, videos_order) DEFERRABLE INITIALLY DEFERRED;
+
+ ALTER TABLE playlists_videos_ids DROP CONSTRAINT playlists_videos_ids_pkey;
+ ALTER TABLE playlists_videos_ids ADD CONSTRAINT playlists_videos_ids_pkey PRIMARY KEY (playlist_id, videos_order);
+
+
+
+