From ef6a2861bd499888cb2f4c2654206460f6ee0153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Thu, 6 Aug 2020 20:53:27 +0200 Subject: [PATCH] fix relationship --- src/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/models.py b/src/models.py index f8de97b..d2ff7de 100644 --- a/src/models.py +++ b/src/models.py @@ -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'))