fix relationship
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-08-06 20:53:27 +02:00
parent 60bf26f0f8
commit ef6a2861bd
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -28,6 +28,7 @@ class SensorStatusEnum(enum.Enum):
class Device(db.Model):
__tablename__ = 'device'
id = db.Column(db.Integer, primary_key=True)
deviceid = db.Column(db.String, nullable=False)
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())
@ -39,4 +40,4 @@ class Sensor(db.Model):
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'))
device_id = db.Column(db.Integer, db.ForeignKey('device.id'))