2021.4 #19
@ -30,6 +30,9 @@ class DatabaseContext(DatabaseContextABC):
|
||||
self._db.connect(connection_string)
|
||||
self._create_tables()
|
||||
|
||||
def save_changes(self):
|
||||
self._db.session.commit()
|
||||
|
||||
def _create_tables(self):
|
||||
try:
|
||||
for subclass in DatabaseModel.__subclasses__():
|
||||
|
@ -27,6 +27,12 @@ class DatabaseContextABC(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
def save_changes(self):
|
||||
"""
|
||||
Saves changes of the database
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def _create_tables(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user