#!/usr/bin/python
from DatabaseInterface import DatabaseInterface
import os
import shutil

def update_database():

    sourcePath = os.path.dirname(os.path.realpath(__file__))

    #Get the database version starting
    DBM = DatabaseInterface(sourcePath + "/ConfigFiles/DatabaseConfig_V0.cfg", True)
    currentVersion = DBM.GetDBVersion()

    if currentVersion < 1:
        DBM = DatabaseInterface()
        DBM.CreateStudentTable()
        DBM.CreateRentalsTable()
        DBM.CreateBoxesTable()
        DBM.CreateComponentTable()
        #shutil.copy(sourcePath + "/ConfigFiles/DatabaseConfig_V1.cfg", DBM.GetDefaultConfigFilePath())
        DBM.SetDBVersion(1)
    #if currentVersion < 2: ...


if __name__ == '__main__':
    update_database()
