From 7f0da30c8b66033287f97ae0ce0030ba7ff97808 Mon Sep 17 00:00:00 2001 From: CrystalP Date: Sun, 28 Apr 2024 12:25:10 -0400 Subject: [PATCH] [videodb] Add Delete Trigger to videoversion no backport as a db version bump is required. --- xbmc/video/VideoDatabase.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index acfa18fb95..286f1311d8 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -369,6 +369,10 @@ void CVideoDatabase::CreateAnalytics() "DELETE FROM videoversion WHERE idFile=old.idFile; " "DELETE FROM art WHERE media_id=old.idFile AND media_type='videoversion'; " "END"); + m_pDS->exec("CREATE TRIGGER delete_videoversion AFTER DELETE ON videoversion FOR EACH ROW BEGIN " + "DELETE FROM art WHERE media_id=old.idFile AND media_type='videoversion'; " + "DELETE FROM streamdetails WHERE idFile=old.idFile; " + "END"); CreateViews(); } @@ -6452,7 +6456,7 @@ void CVideoDatabase::UpdateTables(int iVersion) int CVideoDatabase::GetSchemaVersion() const { - return 131; + return 132; } bool CVideoDatabase::LookupByFolders(const std::string &path, bool shows) @@ -12501,13 +12505,6 @@ bool CVideoDatabase::DeleteVideoAsset(int idFile) if (!path.empty()) InvalidatePathHash(path); - /*! \todo replace with a delete trigger on videoversion */ - m_pDS->exec(PrepareSQL("DELETE FROM art WHERE media_id=%i and media_type='%s'", idFile, - MediaTypeVideoVersion)); - - /*! \todo replace with a delete trigger on videoversion */ - DeleteStreamDetails(idFile); - m_pDS->exec(PrepareSQL("DELETE FROM videoversion WHERE idFile=%i", idFile)); if (!inTransaction) -- 2.11.4.GIT