-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_create.py
37 lines (34 loc) · 1.05 KB
/
db_create.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from senseit import db
from models import *
db.drop_all()
db.create_all()
p1 = Plate('Milk', 'Kitchen')
p2 = Plate('TVsensor', 'Vardagsrum')
p3 = Plate('Car', 'Driveway')
p4 = Plate('Bed', 'Bedroom')
f1 = Function('Leave bed', '4 < 50', 'images/bed.png')
f2 = Function('Milk empty', '1 < 1', 'images/milk.png')
f3 = Function('Car leaving', '2 < 1', 'images/car.png')
f4 = Function('In bed', '4 > 50', 'images/bed.png')
f5 = Function('Milk full', '1 > 0.5', 'images/milk.png')
f6 = Function('Car arriving', '3 > 1000', 'images/car.png')
f7 = Function('Test', '3 > 1000', 'images/car.png')
s1 = Solution('SMHI', 'images/weather.png')
s2 = Solution('PARK', 'images/parking.png')
s3 = Solution('Send shopping remainder', 'images/shopping.png')
p1.functions.append(f2)
p2.functions.append(f3)
f2.solutions.append(s1)
f2.solutions.append(s2)
f3.solutions.append(s1)
db.session.add(p1)
db.session.add(p2)
db.session.add(p3)
db.session.add(p4)
db.session.add(f1)
db.session.add(f4)
db.session.add(f5)
db.session.add(f6)
db.session.add(f7)
db.session.add(s3)
db.session.commit()