Fix #5329 (database integrity fails in 0.6.48)

This commit is contained in:
Kovid Goyal 2010-04-22 03:05:13 -06:00
parent 1127bb435b
commit 5fbb2bae5c

View File

@ -123,10 +123,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
self.is_case_sensitive = not iswindows and not isosx and \ self.is_case_sensitive = not iswindows and not isosx and \
not os.path.exists(self.dbpath.replace('metadata.db', 'MeTAdAtA.dB')) not os.path.exists(self.dbpath.replace('metadata.db', 'MeTAdAtA.dB'))
SchemaUpgrade.__init__(self) SchemaUpgrade.__init__(self)
CustomColumns.__init__(self)
self.initialize_dynamic() self.initialize_dynamic()
def initialize_dynamic(self): def initialize_dynamic(self):
CustomColumns.__init__(self)
template = '''\ template = '''\
(SELECT {query} FROM books_{table}_link AS link INNER JOIN (SELECT {query} FROM books_{table}_link AS link INNER JOIN
{table} ON(link.{link_col}={table}.id) WHERE link.book=books.id) {table} ON(link.{link_col}={table}.id) WHERE link.book=books.id)
@ -1428,6 +1428,7 @@ books_series_link feeds
os.remove(self.dbpath) os.remove(self.dbpath)
shutil.copyfile(dest, self.dbpath) shutil.copyfile(dest, self.dbpath)
self.connect() self.connect()
self.initialize_dynamic()
self.refresh() self.refresh()
if os.path.exists(dest): if os.path.exists(dest):
os.remove(dest) os.remove(dest)