You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
722 B
Python
23 lines
722 B
Python
2 years ago
|
import os
|
||
|
import sys
|
||
|
from peewee import *
|
||
|
from utils.DBModels.BaseModel import *
|
||
|
from utils.DBModels.ClientModels import *
|
||
|
class Client(object):
|
||
|
def __init__(self):
|
||
|
super(Device, self).__init__()
|
||
|
|
||
|
@classmethod
|
||
|
def initDB(self):
|
||
|
dbPath = os.path.join('db', 'project.db')
|
||
|
if os.path.isfile(dbPath):
|
||
|
self.deviceDB = SqliteDatabase(dbPath)
|
||
|
client_proxy.initialize(self.deviceDB)
|
||
|
self.deviceDB.connect()
|
||
|
else:
|
||
|
self.deviceDB = SqliteDatabase(dbPath)
|
||
|
client_proxy.initialize(self.deviceDB)
|
||
|
modelsArr = [DeviceDB]
|
||
|
self.deviceDB.connect()
|
||
|
self.deviceDB.create_tables(modelsArr, safe = True)
|