Fix relations in TicketAssignee

Backrefs were named the same, and foreign_keys were not valid.

For now remove the backrefs to users since there is no obvious use case
for them, they can be easily added back later when one arises.
This commit is contained in:
Ivan Habunek 2018-11-29 16:22:54 +01:00 committed by Drew DeVault
parent 6126b24398
commit 1230023b18
1 changed files with 2 additions and 7 deletions

View File

@ -1,6 +1,5 @@
import sqlalchemy as sa
from srht.database import Base
from enum import Enum
class TicketAssignee(Base):
__tablename__ = 'ticket_assignee'
@ -12,13 +11,9 @@ class TicketAssignee(Base):
ticket = sa.orm.relationship("Ticket", backref=sa.orm.backref("assignees"))
assignee_id = sa.Column(sa.Integer, sa.ForeignKey("user.id"), nullable=False)
assignee = sa.orm.relationship("User",
backref=sa.orm.backref("assigned"),
foreign_keys="assignee_id")
assignee = sa.orm.relationship("User", foreign_keys=[assignee_id])
assigner_id = sa.Column(sa.Integer, sa.ForeignKey("user.id"), nullable=False)
assigner = sa.orm.relationship("User",
backref=sa.orm.backref("assigned"),
foreign_keys="assignee_id")
assigner = sa.orm.relationship("User", foreign_keys=[assigner_id])
role = sa.Column(sa.Unicode(256))