Fix creating an empty library with the same structure as current library not creating custom columns on the first restart after creating the new custom columns. Fixes #1641278 [Custom columns don't copy on create new library](https://bugs.launchpad.net/calibre/+bug/1641278)

This commit is contained in:
Kovid Goyal 2016-11-14 12:22:21 +05:30
parent 9d57aa4e33
commit ac45db67c9

View File

@ -641,6 +641,8 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
default_prefs = olddb.prefs default_prefs = olddb.prefs
except: except:
olddb = None olddb = None
if copy_structure and olddb is not None and default_prefs is not None:
default_prefs['field_metadata'] = olddb.new_api.field_metadata.all_metadata()
try: try:
db = LibraryDatabase(newloc, default_prefs=default_prefs) db = LibraryDatabase(newloc, default_prefs=default_prefs)
except apsw.Error: except apsw.Error: