comparison sat/memory/memory.py @ 3582:71516731d0aa

core (memory/sqla): database migration using Alembic: Alembic database migration tool, which is the recommended one for SQLAlchemy has been integrated. When a database is created, it will be used to stamp to current (head) revision, otherwise, DB will be checked to see if it needs to be updated, and upgrade will be triggered if necessary.
author Goffi <goffi@goffi.org>
date Fri, 25 Jun 2021 17:55:23 +0200
parents 888109774673
children 001ea5f4a2f9
comparison
equal deleted inserted replaced
3581:84ea57a8d6b3 3582:71516731d0aa
221 log.debug( 221 log.debug(
222 "FIXME: PasswordSessions should ask for the profile password after the session expired" 222 "FIXME: PasswordSessions should ask for the profile password after the session expired"
223 ) 223 )
224 224
225 225
226 class Memory(object): 226 class Memory:
227 """This class manage all the persistent information""" 227 """This class manage all the persistent information"""
228 228
229 def __init__(self, host): 229 def __init__(self, host):
230 log.info(_("Memory manager init")) 230 log.info(_("Memory manager init"))
231 self.host = host 231 self.host = host
239 self.disco = Discovery(host) 239 self.disco = Discovery(host)
240 self.config = tools_config.parseMainConf(log_filenames=True) 240 self.config = tools_config.parseMainConf(log_filenames=True)
241 self._cache_path = Path(self.getConfig("", "local_dir"), C.CACHE_DIR) 241 self._cache_path = Path(self.getConfig("", "local_dir"), C.CACHE_DIR)
242 242
243 async def initialise(self): 243 async def initialise(self):
244 database_file = os.path.expanduser( 244 self.storage = Storage()
245 os.path.join(self.getConfig("", "local_dir"), C.SAVEFILE_DATABASE)
246 )
247 self.storage = Storage(database_file, self.host.version)
248 await self.storage.initialise() 245 await self.storage.initialise()
249 PersistentDict.storage = self.storage 246 PersistentDict.storage = self.storage
250 self.params = Params(self.host, self.storage) 247 self.params = Params(self.host, self.storage)
251 log.info(_("Loading default params template")) 248 log.info(_("Loading default params template"))
252 self.params.load_default_params() 249 self.params.load_default_params()