DBRepair: Prevent negative watch counts

Changes grouping and deletion.
Thanks @tkkg1994
This commit is contained in:
ChuckPa 2023-07-30 00:38:58 -04:00
parent 2d93f36ad9
commit 91959549ac
No known key found for this signature in database
GPG Key ID: 3CE28A0F6BC31B5B

View File

@ -1297,9 +1297,8 @@ DoImport(){
if [ $PurgeDuplicates -eq 1 ]; then
cat <<EOF | "$PLEX_SQLITE" "$TMPDIR/$CPPL.db-IMPORT-$TimeStamp"
DELETE FROM metadata_item_settings
WHERE id in (SELECT MIN(id)
FROM metadata_item_settings
GROUP BY guid HAVING COUNT(guid) > 1);
WHERE rowid NOT IN
( SELECT MIN(rowid) FROM metadata_item_settings GROUP BY guid, account_id );
EOF
fi