# 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 * # creates the database db.create_all() # after the last command you should now be able to see database.db file # in the project folder # Data Type Seeds data_type_REAL = Data_type(data_type='Floating Point', plc_type='REAL') data_type_INT = Data_type(data_type='Integer', plc_type='INT') data_type_BOOL = Data_type(data_type='Boolean', plc_type='BOOL') db.session.add(data_type_REAL) db.session.add(data_type_INT) db.session.add(data_type_BOOL) # Device Type Seeds device_type_CLX = Device_type(device_type='CLX') device_type_u800 = Device_type(device_type='Micro800') device_type_E300 = Device_type(device_type='E300') db.session.add(device_type_CLX) db.session.add(device_type_u800) db.session.add(device_type_E300) # Tag Class Seeds tag_class_stroke = Tag_class(class_type='stroke', description="Stroke Information") tag_class_history = Tag_class(class_type='history', description="Historical Data") tag_class_gaugeoff = Tag_class(class_type='gaugeoff', description="Gauge Off Data") tag_class_welltest = Tag_class(class_type='welltest', description="Well Test Data") tag_class_custom = Tag_class(class_type='custom', description="Custom Tag") tag_class_handshake = Tag_class(class_type='handshake', description="PLC Handshake Tag") db.session.add(tag_class_stroke) db.session.add(tag_class_history) db.session.add(tag_class_gaugeoff) db.session.add(tag_class_welltest) db.session.add(tag_class_custom) db.session.add(tag_class_handshake) db.session.add(Device(device_type_id=1, address="192.168.1.10")) db.session.commit()