-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
57 lines (46 loc) · 2.09 KB
/
models.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from sqlalchemy import Column, Integer, String, DateTime, Float, Boolean, ForeignKey
from database import Base
class Container(Base):
__tablename__ = "container"
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String, nullable=False)
cold = Column(Boolean, nullable=False)
temperature = Column(Float, nullable=False)
slopex = Column(Float, nullable=False)
slopey = Column(Float, nullable=False)
slopez = Column(Float, nullable=False)
humidity = Column(Integer, nullable=False)
vibration = Column(Boolean, nullable=False)
port = Column(String, nullable=False)
wharf = Column(String, nullable=False)
create_date = Column(DateTime, nullable=False)
modify_date = Column(DateTime, nullable=True)
class Humidity_Temperature(Base):
__tablename__ = "humidity_temperature"
id = Column(Integer, primary_key=True, autoincrement=True)
cid = Column(Integer, ForeignKey("container.id"), nullable=False)
temperature = Column(Float, nullable=False)
humidity = Column(Integer, nullable=False)
create_date = Column(DateTime, nullable=False)
class Slope(Base):
__tablename__ = "slope"
id = Column(Integer, primary_key=True, autoincrement=True)
cid = Column(Integer, ForeignKey("container.id"), nullable=False)
slopex = Column(Float, nullable=False)
slopey = Column(Float, nullable=False)
slopez = Column(Float, nullable=False)
create_date = Column(DateTime, nullable=False)
class Vibration(Base):
__tablename__ = "vibration"
id = Column(Integer, primary_key=True, autoincrement=True)
cid = Column(Integer, ForeignKey("container.id"), nullable=False)
vibration = Column(Boolean, nullable=False)
create_date = Column(DateTime, nullable=False)
class User(Base):
__tablename__ = "user"
id = Column(Integer, autoincrement=True, primary_key=True)
name = Column(String, nullable=False)
password = Column(String, nullable=False)
email = Column(String, unique=True, nullable=False)
create_date = Column(DateTime, nullable=False)
administrator = Column(Boolean, nullable=False)