Add new realtion

This commit is contained in:
Stephan Porada 2019-10-17 13:32:22 +02:00
parent 2c4a6a8cea
commit 82fb73de1a

View File

@ -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')