class_sqlThread refactoring
This commit is contained in:
parent
3337f40f9d
commit
3a6be347fd
|
@ -106,12 +106,6 @@ class BitmessageDB(object):
|
||||||
Initialize upgrade level
|
Initialize upgrade level
|
||||||
"""
|
"""
|
||||||
|
|
||||||
while self.sql_schema_version < self.max_level:
|
|
||||||
self._upgrade_one_level_sql_statement(self.sql_schema_version)
|
|
||||||
|
|
||||||
def upgrade_schema_if_old_version(self):
|
|
||||||
""" check settings table exists """
|
|
||||||
|
|
||||||
query = "SELECT name FROM sqlite_master WHERE type='table' AND name='settings'"
|
query = "SELECT name FROM sqlite_master WHERE type='table' AND name='settings'"
|
||||||
parameters = ()
|
parameters = ()
|
||||||
self.cur.execute(query, parameters)
|
self.cur.execute(query, parameters)
|
||||||
|
@ -128,9 +122,15 @@ class BitmessageDB(object):
|
||||||
|
|
||||||
# initiate sql file
|
# initiate sql file
|
||||||
self.initialize_sql("upg_sc_if_old_ver_1")
|
self.initialize_sql("upg_sc_if_old_ver_1")
|
||||||
|
self.conn.commit()
|
||||||
# After code refactoring, the possible status values for sent messages
|
# After code refactoring, the possible status values for sent messages
|
||||||
# have changed.
|
# have changed.
|
||||||
self.initialize_sql("upg_sc_if_old_ver_2")
|
self.initialize_sql("upg_sc_if_old_ver_2")
|
||||||
|
self.conn.commit()
|
||||||
|
|
||||||
|
while self.sql_schema_version < self.max_level:
|
||||||
|
self._upgrade_one_level_sql_statement(self.sql_schema_version)
|
||||||
|
self.conn.commit()
|
||||||
|
|
||||||
def check_columns_can_store_binary_null(self):
|
def check_columns_can_store_binary_null(self):
|
||||||
"""
|
"""
|
||||||
|
@ -403,8 +403,6 @@ class sqlThread(threading.Thread):
|
||||||
|
|
||||||
helper_startup.updateConfig()
|
helper_startup.updateConfig()
|
||||||
|
|
||||||
self.db.upgrade_schema_if_old_version()
|
|
||||||
|
|
||||||
self.db.upgrade_to_latest()
|
self.db.upgrade_to_latest()
|
||||||
|
|
||||||
self.db.check_columns_can_store_binary_null()
|
self.db.check_columns_can_store_binary_null()
|
||||||
|
|
Reference in New Issue
Block a user