Merge pull request #87 from ChuckPa/chuckpa/Prevent-Negative-Watch-Counts

DBRepair:   Prevent negative watch counts
This commit is contained in:
Chuck
2023-07-30 00:41:21 -04:00
committed by GitHub

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