mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Mark books as dirty only after custom column is actually deleted
This commit is contained in:
parent
d8c244a83b
commit
a2d6b66bc2
@ -515,6 +515,7 @@ class DB(object):
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def initialize_custom_columns(self): # {{{
|
def initialize_custom_columns(self): # {{{
|
||||||
|
self.custom_columns_deleted = False
|
||||||
with self.conn:
|
with self.conn:
|
||||||
# Delete previously marked custom columns
|
# Delete previously marked custom columns
|
||||||
for record in self.conn.get(
|
for record in self.conn.get(
|
||||||
@ -537,6 +538,7 @@ class DB(object):
|
|||||||
DROP TABLE IF EXISTS {lt};
|
DROP TABLE IF EXISTS {lt};
|
||||||
'''.format(table=table, lt=lt)
|
'''.format(table=table, lt=lt)
|
||||||
)
|
)
|
||||||
|
self.custom_columns_deleted = True
|
||||||
self.conn.execute('DELETE FROM custom_columns WHERE mark_for_delete=1')
|
self.conn.execute('DELETE FROM custom_columns WHERE mark_for_delete=1')
|
||||||
|
|
||||||
# Load metadata for custom columns
|
# Load metadata for custom columns
|
||||||
|
@ -107,6 +107,9 @@ class Cache(object):
|
|||||||
|
|
||||||
self._search_api = Search(self, 'saved_searches', self.field_metadata.get_search_terms())
|
self._search_api = Search(self, 'saved_searches', self.field_metadata.get_search_terms())
|
||||||
self.initialize_dynamic()
|
self.initialize_dynamic()
|
||||||
|
if self.backend.custom_columns_deleted:
|
||||||
|
self.mark_as_dirty(self.all_book_ids())
|
||||||
|
self.backend.custom_columns_deleted = False
|
||||||
|
|
||||||
@write_api
|
@write_api
|
||||||
def initialize_dynamic(self):
|
def initialize_dynamic(self):
|
||||||
@ -1547,7 +1550,6 @@ class Cache(object):
|
|||||||
@write_api
|
@write_api
|
||||||
def delete_custom_column(self, label=None, num=None):
|
def delete_custom_column(self, label=None, num=None):
|
||||||
self.backend.delete_custom_column(label, num)
|
self.backend.delete_custom_column(label, num)
|
||||||
self._mark_as_dirty(self._all_book_ids())
|
|
||||||
|
|
||||||
@write_api
|
@write_api
|
||||||
def create_custom_column(self, label, name, datatype, is_multiple, editable=True, display={}):
|
def create_custom_column(self, label, name, datatype, is_multiple, editable=True, display={}):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user