mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Fix unique img_hash in database
This commit is contained in:
parent
a8863a5aeb
commit
c0453eae47
1 changed files with 8 additions and 1 deletions
|
@ -784,7 +784,7 @@ def dbcheck():
|
|||
# image_hash_lookup table :: This table keeps record of the image hash lookups
|
||||
c_db.execute(
|
||||
'CREATE TABLE IF NOT EXISTS image_hash_lookup (id INTEGER PRIMARY KEY AUTOINCREMENT, '
|
||||
'img_hash TEXT, img TEXT, rating_key INTEGER, width INTEGER, height INTEGER, '
|
||||
'img_hash TEXT UNIQUE, img TEXT, rating_key INTEGER, width INTEGER, height INTEGER, '
|
||||
'opacity INTEGER, background TEXT, blur INTEGER, fallback TEXT)'
|
||||
)
|
||||
|
||||
|
@ -2210,6 +2210,13 @@ def dbcheck():
|
|||
'ALTER TABLE exports ADD COLUMN total_items INTEGER DEFAULT 0'
|
||||
)
|
||||
|
||||
# Upgrade image_hash_lookup table from earlier versions
|
||||
try:
|
||||
c_db.execute('DELETE FROM image_hash_lookup '
|
||||
'WHERE id NOT IN (SELECT MIN(id) FROM image_hash_lookup GROUP BY img_hash)')
|
||||
except sqlite3.OperationalError:
|
||||
pass
|
||||
|
||||
# Add "Local" user to database as default unauthenticated user.
|
||||
result = c_db.execute('SELECT id FROM users WHERE username = "Local"')
|
||||
if not result.fetchone():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue