mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-15 09:07:43 +00:00
Deletes duplicates found in tv provider cache before creating unique index for provider table or just performs cleanup of any duplicate record period.
This commit is contained in:
parent
9f8c49ce88
commit
13cbffb6d4
1 changed files with 3 additions and 0 deletions
|
@ -54,6 +54,9 @@ class CacheDBConnection(db.DBConnection):
|
||||||
if not self.hasTable(providerName):
|
if not self.hasTable(providerName):
|
||||||
self.action(
|
self.action(
|
||||||
"CREATE TABLE [" + providerName + "] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT)")
|
"CREATE TABLE [" + providerName + "] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT)")
|
||||||
|
else:
|
||||||
|
# remove duplicates
|
||||||
|
self.action("DELETE FROM " + providerName + " WHERE url NOT IN (SELECT url FROM " + providerName + " GROUP BY url")
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
if str(e) != "table [" + providerName + "] already exists":
|
if str(e) != "table [" + providerName + "] already exists":
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in a new issue