added REACTION_UUID field to Reaction
This commit is contained in:
parent
45ae1de69b
commit
ef5ed73c9e
@ -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
|
from sqlalchemy.orm import relationship, declarative_base
|
||||||
|
|
||||||
Base = 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")
|
IMG = Column(LargeBinary(length=2**24), comment="Binary data of the image associated to this npc and trait")
|
||||||
NPC = relationship("Npc")
|
NPC = relationship("Npc")
|
||||||
TRAIT = relationship("Trait")
|
TRAIT = relationship("Trait")
|
||||||
|
REACTION_UUID = Column(UUID, unique=True, comment="ID of this reaction")
|
||||||
|
|
||||||
def __init__(self, REACTION_ID, NPC_ID, TRAIT_ID):
|
def __init__(self, REACTION_ID, NPC_ID, TRAIT_ID):
|
||||||
self.REACTION_ID = REACTION_ID
|
self.REACTION_ID = REACTION_ID
|
||||||
self.NPC_ID = NPC_ID
|
self.NPC_ID = NPC_ID
|
||||||
self.TRAIT_ID = TRAIT_ID
|
self.TRAIT_ID = TRAIT_ID
|
||||||
|
self.REACTION_UUID = uuid.uuid4()
|
||||||
|
|
||||||
def __str__(self) -> str:
|
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:
|
def __repr__(self) -> str:
|
||||||
return self.__str__()
|
return self.__str__()
|
Loading…
Reference in New Issue
Block a user