add autoincrement to some primary keys

This commit is contained in:
Thomas Rubini 2023-03-19 10:29:13 +01:00
parent 9fcd7c159a
commit 3aae90aab8
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373

View File

@ -11,7 +11,7 @@ class Text(Base):
__tablename__ = 'T_TEXT'
TEXT_ID = Column(Integer, primary_key=True, comment="ID of this specific text. These IDs may be recycled in the future and may only be used for a short time period.")
TEXT_ID = Column(Integer, autoincrement=True, primary_key=True, comment="ID of this specific text. These IDs may be recycled in the future and may only be used for a short time period.")
LID = Column(Integer, ForeignKey("T_LOCALE.LID"), comment="Reference to the locale that this text provides")
LANG = Column(VARCHAR(2), comment="lang ID of the text value in this row, e.g FR, EN, ES")
TEXT = Column(Text, comment="Actual text stored")
@ -39,7 +39,7 @@ class Locale(Base):
"""
__tablename__ = 'T_LOCALE'
LID = Column(Integer, primary_key=True, comment="ID of this locale (the other tables references to this with *_LID columns)")
LID = Column(Integer, primary_key=True, autoincrement=True, comment="ID of this locale (the other tables references to this with *_LID columns)")
def __init__(self, LID):
self.LID = LID
@ -57,7 +57,7 @@ class Place(Base):
"""
__tablename__ = 'T_PLACE'
PLACE_ID = Column(Integer, primary_key=True, comment="ID of this place")
PLACE_ID = Column(Integer, primary_key=True, autoincrement=True, comment="ID of this place")
NAME_LID = Column(Integer, ForeignKey("T_LOCALE.LID"), comment="Place name")
LOCALE = relationship("Locale")
@ -100,7 +100,7 @@ class Answer(Base):
"""
__tablename__ = "T_ANSWER"
QUESTION_TYPE_ID = Column(Integer,ForeignKey("T_QUESTION_TYPE.QUESTION_TYPE_ID"),primary_key=True, comment="Question type ID")
QUESTION_TYPE_ID = Column(Integer, ForeignKey("T_QUESTION_TYPE.QUESTION_TYPE_ID"), primary_key=True, comment="Question type ID")
NPC_ID = Column(Integer, ForeignKey("T_NPC.NPC_ID"), primary_key=True, comment="ID of the NPC that will say this answer")
TEXT_LID = Column(Integer, ForeignKey("T_LOCALE.LID"), comment="Text of the answer")
LOCALE = relationship("Locale")
@ -145,7 +145,7 @@ class Trait(Base):
Store reaction types, e.g 'happy', 'sad', without relation with NPCs
"""
__tablename__ = "T_TRAIT"
TRAIT_ID = Column(Integer, primary_key=True, comment="ID of this trait")
TRAIT_ID = Column(Integer, primary_key=True, autoincrement=True, comment="ID of this trait")
NAME_LID = Column(Integer, ForeignKey("T_LOCALE.LID"), comment="Name of this trait")
DESC_LID = Column(Integer, ForeignKey("T_LOCALE.LID"), comment="Description of this trait")
@ -170,7 +170,7 @@ class Reaction(Base):
Relation between a NPC and a Trait
"""
__tablename__ = "T_REACTION"
REACTION_ID = Column(Integer, primary_key=True, comment="ID of this reaction")
REACTION_ID = Column(Integer, primary_key=True, autoincrement=True, comment="ID of this reaction")
NPC_ID = Column(Integer, ForeignKey("T_NPC.NPC_ID"), primary_key=True, comment="Name of the NPC that will have this reaction")
TRAIT_ID = Column(Integer, ForeignKey("T_TRAIT.TRAIT_ID"), primary_key=True, comment="ID of the trait of this reaction")
NPC = relationship("Npc")