As per PR comments:

- Remove Organisation.services
- added backref='services' to Services.organisation relationship and removed redundant foreign_keys argument.
This commit is contained in:
Rebecca Law
2019-08-14 13:23:20 +01:00
parent c4127d0508
commit fdee6cbfb2
2 changed files with 1 additions and 8 deletions

View File

@@ -349,12 +349,6 @@ class Organisation(db.Model):
active = db.Column(db.Boolean, nullable=False, default=True)
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow)
services = db.relationship(
'Service',
uselist=True,
backref=db.backref('services'))
agreement_signed = db.Column(db.Boolean, nullable=True)
agreement_signed_at = db.Column(db.DateTime, nullable=True)
agreement_signed_by_id = db.Column(
@@ -480,7 +474,7 @@ class Service(db.Model, Versioned):
go_live_at = db.Column(db.DateTime, nullable=True)
organisation_id = db.Column(UUID(as_uuid=True), db.ForeignKey('organisation.id'), index=True, nullable=True)
organisation = db.relationship('Organisation', foreign_keys=[organisation_id])
organisation = db.relationship('Organisation', backref='services')
email_branding = db.relationship(
'EmailBranding',