🔧 chore(base.py): add teardown method to Engine class for proper cleanup of the database engine

🔧 chore(base.py): add logging statement to teardown method for debugging purposes
🔧 chore(base.py): call dispose method on database engine instance in teardown method to properly release resources
🔧 chore(base.py): set database engine instance to None in teardown method to ensure proper cleanup
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-30 09:51:02 -03:00
commit afca3fe3e7

View file

@ -39,6 +39,13 @@ class Engine:
cls._instance = None
cls.create()
@classmethod
def teardown(cls):
logger.debug("Tearing down database engine")
if cls._instance is not None:
cls._instance.dispose()
cls._instance = None
def create_db_and_tables():
logger.debug("Creating database and tables")