forked from gergely/calendar-social
Add an ID field to the Invite model
It turned out the multi-field primary key is not a good idea.
This commit is contained in:
parent
582e53038b
commit
0fb0ff8c99
@ -597,19 +597,21 @@ class Invitation(db.Model): # pylint: disable=too-few-public-methods
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__tablename__ = 'invitations'
|
__tablename__ = 'invitations'
|
||||||
|
# pylint: disable=invalid-name
|
||||||
|
id = db.Column(db.Integer(), primary_key=True)
|
||||||
|
|
||||||
#: The ID of the sender’s profile
|
#: The ID of the sender’s profile
|
||||||
sender_id = db.Column(db.Integer(), db.ForeignKey('profiles.id'), primary_key=True)
|
sender_id = db.Column(db.Integer(), db.ForeignKey('profiles.id'), index=True)
|
||||||
|
|
||||||
sender = db.relationship('Profile', foreign_keys=[sender_id])
|
sender = db.relationship('Profile', foreign_keys=[sender_id])
|
||||||
|
|
||||||
#: The ID of the invitee’s profile
|
#: The ID of the invitee’s profile
|
||||||
invitee_id = db.Column(db.Integer(), db.ForeignKey('profiles.id'), primary_key=True)
|
invitee_id = db.Column(db.Integer(), db.ForeignKey('profiles.id'), index=True)
|
||||||
|
|
||||||
invitee = db.relationship('Profile', foreign_keys=[invitee_id])
|
invitee = db.relationship('Profile', foreign_keys=[invitee_id])
|
||||||
|
|
||||||
#: The ID of the event
|
#: The ID of the event
|
||||||
event_id = db.Column(db.Integer(), db.ForeignKey('events.id'), primary_key=True)
|
event_id = db.Column(db.Integer(), db.ForeignKey('events.id'), index=True)
|
||||||
|
|
||||||
event = db.relationship('Event', backref=db.backref('invitations', lazy='dynamic'))
|
event = db.relationship('Event', backref=db.backref('invitations', lazy='dynamic'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user