T-Ratnosaure / DiscordVoteBot

Bot which organizes the HackademINT's passation vote
0 stars 0 forks source link

Fix bug sqlalchemy #5

Open zteeed opened 4 years ago

zteeed commented 4 years ago
class Vote(Base):
    __tablename__ = 'vote'
    id = Column(Integer, primary_key=True)
    member = relationship('Member')
    poste = relationship('Poste')
    candidature = relationship('Candidature')
    poste_id = Column(Integer, ForeignKey('poste.id', ondelete="CASCADE"))
    member_id = Column(Integer, ForeignKey("member.id", ondelete="CASCADE"))
    candidat_id = Column(Integer, ForeignKey('candidature.id', ondelete="CASCADE"))

J'ai remarqué qu'une concordance entre le __tablename__ et ne nom indiqué dans ForeignKey résoud le problème

zteeed commented 4 years ago

De plus, a quoi sert poste_id et member_id dans Vote si ils sont deja dans Candidature par jointure de table sur candidat_id ?