From 82fb73de1a38820650b8c48138e4ccb11adff621 Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Thu, 17 Oct 2019 13:32:22 +0200 Subject: [PATCH] Add new realtion --- app/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models.py b/app/models.py index e4ff1733..c318e9aa 100644 --- a/app/models.py +++ b/app/models.py @@ -259,6 +259,11 @@ class JobInput(db.Model): id = db.Column(db.Integer, primary_key=True) filename = db.Column(db.String(255)) job_id = db.Column(db.Integer, db.ForeignKey('jobs.id')) + # Relationships + results = db.relationship('JobResult', + backref='job_input', + lazy='dynamic', + cascade='save-update, merge, delete') class JobResult(db.Model): @@ -270,6 +275,7 @@ class JobResult(db.Model): id = db.Column(db.Integer, primary_key=True) filename = db.Column(db.String(255)) job_id = db.Column(db.Integer, db.ForeignKey('jobs.id')) + job_input_id = db.Column(db.Integer, db.ForeignKey('job_inputs.id')) class Job(db.Model): @@ -384,7 +390,7 @@ class Corpus(db.Model): user_id = db.Column(db.Integer, db.ForeignKey('users.id')) # Relationships files = db.relationship('CorpusFile', - backref='relation', + backref='corpus', lazy='dynamic', cascade='save-update, merge, delete')