use postgres specific UUID
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-08-06 16:57:40 +02:00
parent c091c53a3e
commit ea35672455
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3
import enum
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.sql import func
from db import db
@ -28,7 +29,7 @@ class SensorStatusEnum(enum.Enum):
class Device(db.Model):
__tablename__ = 'device'
id = db.Column(db.Integer, primary_key=True)
sensorid = db.Column(db.UUID, nullable=False)
sensorid = db.Column(UUID(as_uuid=True), 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())