do not use UUID type for compatibility with old MariaDB servers

This commit is contained in:
Thomas Rubini 2023-03-26 16:22:20 +02:00
parent daeea9cfd7
commit f3a27be971
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import uuid
from sqlalchemy import Column, Integer, VARCHAR, Text, LargeBinary, ForeignKey, UUID
from sqlalchemy import Column, Integer, VARCHAR, Text, LargeBinary, ForeignKey
from sqlalchemy.orm import relationship, declarative_base
Base = declarative_base()
@ -200,7 +200,7 @@ 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")
REACTION_UUID = Column(VARCHAR(255), unique=True, comment="ID of this reaction")
def __init__(self, REACTION_ID, NPC_ID, TRAIT_ID):
self.REACTION_ID = REACTION_ID

View File

@ -161,7 +161,7 @@ def get_npc_reaction():
@routes_api.route("/getReaction", methods=["GET", "POST"])
def get_reaction():
input_uuid = flask.request.values.get("uuid")
results = db.session.execute(select(Reaction).where(Reaction.REACTION_UUID==uuid.UUID(input_uuid)))
results = db.session.execute(select(Reaction).where(Reaction.REACTION_UUID==input_uuid))
row = results.first()
if row == None: