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
commit 6307a9a5bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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