added backup system!

This commit is contained in:
2022-10-07 22:53:23 +02:00
parent 879ee79a90
commit 87229a654e
5 changed files with 82 additions and 2 deletions

View File

@@ -1,7 +1,21 @@
import os
from models.database import Database
class Utils:
@staticmethod
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')
os.system('cls' if os.name == 'nt' else 'clear')
@staticmethod
def export_db(file):
with open(f"./{file}", 'w') as f:
for line in Database.connection.iterdump():
f.write('%s\n' % line)
@staticmethod
def import_db(file):
with open(f"./{file}", 'r') as f:
str = f.read()
Database.connection.executescript(str)