diff --git a/truthinquiry/ext/database/models.py b/truthinquiry/ext/database/models.py index 3535f5c..c53d077 100644 --- a/truthinquiry/ext/database/models.py +++ b/truthinquiry/ext/database/models.py @@ -1,4 +1,6 @@ -from sqlalchemy import Column, Integer, VARCHAR, Text, LargeBinary, ForeignKey +import uuid + +from sqlalchemy import Column, Integer, VARCHAR, Text, LargeBinary, ForeignKey, UUID from sqlalchemy.orm import relationship, declarative_base Base = declarative_base() @@ -198,14 +200,16 @@ class Reaction(Base): IMG = Column(LargeBinary(length=2**24), comment="Binary data of the image associated to this npc and trait") NPC = relationship("Npc") TRAIT = relationship("Trait") + REACTION_UUID = Column(UUID, unique=True, comment="ID of this reaction") def __init__(self, REACTION_ID, NPC_ID, TRAIT_ID): self.REACTION_ID = REACTION_ID self.NPC_ID = NPC_ID self.TRAIT_ID = TRAIT_ID + self.REACTION_UUID = uuid.uuid4() def __str__(self) -> str: - return f"Reaction(REACTION_ID={self.REACTION_ID}, NPC_ID={self.NPC_ID}, TRAIT_ID={self.TRAIT_ID})" + return f"Reaction(REACTION_ID={self.REACTION_ID}, NPC_ID={self.NPC_ID}, TRAIT_ID={self.TRAIT_ID}, REACTION_UUID={self.REACTION_UUID})" def __repr__(self) -> str: return self.__str__() \ No newline at end of file