This commit is contained in:
parent
b8b4a5849a
commit
60bf26f0f8
@ -9,3 +9,4 @@ marshmallow-sqlalchemy
|
||||
flask-marshmallow
|
||||
paho-mqtt
|
||||
flask-mqtt
|
||||
psycopg2-binary
|
||||
|
@ -28,7 +28,6 @@ class SensorStatusEnum(enum.Enum):
|
||||
class Device(db.Model):
|
||||
__tablename__ = 'device'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
sensorid = db.Column(db.String, nullable=True)
|
||||
status = db.Column(db.Enum(DeviceStatusEnum), nullable=False)
|
||||
url = db.Column(db.String, nullable=False)
|
||||
lastupdate = db.Column(db.TIMESTAMP, nullable=False, server_default=func.now(), onupdate=func.current_timestamp())
|
||||
@ -37,6 +36,7 @@ class Device(db.Model):
|
||||
|
||||
class Sensor(db.Model):
|
||||
__tablename__ = 'sensor'
|
||||
id = db.Column(db.String, primary_key=True)
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
sensorid = db.Column(db.String, nullable=False)
|
||||
status = db.Column(db.Enum(SensorStatusEnum), nullable=False)
|
||||
device_id = db.Column(db.String, db.ForeignKey('device.id'))
|
||||
|
Loading…
Reference in New Issue
Block a user