From 7616f6114614630620e6c5ff27bf112a73cd3afd Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Sun, 19 Dec 2010 22:31:54 +0100 Subject: [PATCH] Episode GUID should be unique per-podcast only --- src/gpodder/dbsqlite.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gpodder/dbsqlite.py b/src/gpodder/dbsqlite.py index 3241dba7..81429cb0 100644 --- a/src/gpodder/dbsqlite.py +++ b/src/gpodder/dbsqlite.py @@ -109,7 +109,7 @@ class Database(object): ('current_position_updated', 'INTEGER', True, '0'), # Set to NOW when updating current_position ) INDEX_EPISODES = ( - ('guid', 'UNIQUE INDEX'), + ('guid', 'INDEX'), ('filename', 'UNIQUE INDEX'), ('channel_id', 'INDEX'), ('pubDate', 'INDEX'), @@ -674,6 +674,9 @@ class Database(object): for column, typ in index_list: cur.execute('CREATE %s IF NOT EXISTS idx_%s ON %s (%s)' % (typ, column, table_name, column)) + if table_name == self.TABLE_EPISODES: + cur.execute('CREATE UNIQUE INDEX IF NOT EXISTS idx_guids ON %s (%s)' % (table_name, ', '.join(('channel_id', 'guid')))) + self.lock.release() def delete_episode_by_guid(self, guid, channel_id): -- 2.11.4.GIT