mirror of
				https://github.com/iv-org/invidious.git
				synced 2025-10-30 20:22:00 +00:00 
			
		
		
		
	Merge pull request #2771 from matthewmcgarvey/delete-playlists
Fix playlist deletion
This commit is contained in:
		| @@ -21,13 +21,12 @@ module Invidious::Database::Playlists | ||||
|     PG_DB.exec(request, args: playlist_array) | ||||
|   end | ||||
|  | ||||
|   # this function is a bit special: it will also remove all videos | ||||
|   # related to the given playlist ID in the "playlist_videos" table, | ||||
|   # in addition to deleting said ID from "playlists". | ||||
|   # deletes the given playlist and connected playlist videos | ||||
|   def delete(id : String) | ||||
|     PlaylistVideos.delete_by_playlist(id) | ||||
|     request = <<-SQL | ||||
|       DELETE FROM playlist_videos * WHERE plid = $1; | ||||
|       DELETE FROM playlists * WHERE id = $1 | ||||
|       DELETE FROM playlists * | ||||
|       WHERE id = $1 | ||||
|     SQL | ||||
|  | ||||
|     PG_DB.exec(request, id) | ||||
| @@ -207,6 +206,15 @@ module Invidious::Database::PlaylistVideos | ||||
|     PG_DB.exec(request, index) | ||||
|   end | ||||
|  | ||||
|   def delete_by_playlist(plid : String) | ||||
|     request = <<-SQL | ||||
|       DELETE FROM playlist_videos * | ||||
|       WHERE plid = $1 | ||||
|     SQL | ||||
|  | ||||
|     PG_DB.exec(request, plid) | ||||
|   end | ||||
|  | ||||
|   # ------------------- | ||||
|   #  Salect | ||||
|   # ------------------- | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Samantaz Fox
					Samantaz Fox