import sys
# the sqlalchemy db object
from app import db

# we have to import the models so that sqlalchemy can detect them and create the db
# how else would it know what to create ?
from app.datalogger.models import *

num_tapers = BackupRestore(tag="Card_Current.Params.Num_Tapers", device_id=1)
taper_length = [BackupRestore(tag="Taper.Taper[{}].Setup.Length".format(i), device_id=1) for i in range(1, 10)]
taper_diameter = [BackupRestore(tag="Taper.Taper[{}].Setup.Diameter".format(i), device_id=1) for i in range(1, 10)]
taper_material = [BackupRestore(tag="Taper.Taper[{}].Setup.Material".format(i), device_id=1) for i in range(1, 10)]
pump_diameter = BackupRestore(tag='UnitConfig.Pump_Diameter', device_id=1)

db.session.add(num_tapers)
for i in range(0, len(taper_length)):
    db.session.add(taper_length[i])

for i in range(0, len(taper_diameter)):
    db.session.add(taper_diameter[i])

for i in range(0, len(taper_material)):
    db.session.add(taper_material[i])

db.session.add(pump_diameter)

db.session.commit()
