update schema to use template_history for accurate template details

only in the public notification endpoint so far for fear of breaking
things - in an ideal world i'd remove the template relationship
from models entirely and replace that with actual_template
This commit is contained in:
Leo Hemsted
2016-08-09 16:53:09 +01:00
parent 46c0728b12
commit 4ba3745159
4 changed files with 35 additions and 16 deletions

View File

@@ -448,9 +448,6 @@ class Notification(db.Model):
reference = db.Column(db.String, nullable=True, index=True)
_personalisation = db.Column(db.String, nullable=True)
# __table_args__ = (
# ForeignKeyConstraint(['template_id', 'template_version'], ['template_history.id', 'template_history.version']),
# )
actual_template = db.relationship('TemplateHistory', primaryjoin=and_(
foreign(template_id) == remote(TemplateHistory.id),
foreign(template_version) == remote(TemplateHistory.version)