Delete tables after upgrade

This commit is contained in:
Dimitris Zlatanidis 2022-05-31 12:27:42 +03:00
parent 0d6ca9aa33
commit 359aa650fa

View file

@ -811,6 +811,7 @@ class Upgrade:
self.meta = _meta_
self.log_path = self.meta.log_path
self.lib_path = self.meta.lib_path
self.session = session
def run(self, repos):
"""Removing and creating the packages lists
@ -825,6 +826,8 @@ class Upgrade:
changelogs = f"{self.log_path}{repo}/ChangeLog.txt"
self.del_tables(repo)
if os.path.isfile(changelogs):
os.remove(changelogs)
@ -843,6 +846,11 @@ class Upgrade:
update = Update()
update.run(repos)
def del_tables(self, repo):
if repo == 'sbo':
self.session.query(SBoTable).delete() # delete all data
self.session.commit()
class Update: