class_sqlThread refactoring

This commit is contained in:
shportix 2023-09-18 22:06:23 +03:00
parent 3337f40f9d
commit 3a6be347fd
No known key found for this signature in database
GPG Key ID: 2594F3870220CC1E

View File

@ -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()