mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Remove unnecessary deletes which hare handled by cascade options
This commit is contained in:
parent
22114dd464
commit
6f842a1092
@ -241,10 +241,7 @@ class User(UserMixin, db.Model):
|
||||
'''
|
||||
Delete the user and its corpora and jobs from database and filesystem.
|
||||
'''
|
||||
for job in self.jobs:
|
||||
job.delete()
|
||||
for corpus in self.corpora:
|
||||
corpus.delete()
|
||||
|
||||
db.session.delete(self)
|
||||
db.session.commit()
|
||||
|
||||
@ -365,10 +362,7 @@ class Job(db.Model):
|
||||
'''
|
||||
Delete the job and its inputs and results from the database.
|
||||
'''
|
||||
for input in self.inputs:
|
||||
db.session.delete(input)
|
||||
for result in self.results:
|
||||
db.session.delete(result) # TODO: shouldn't this happen through the cascade option?
|
||||
|
||||
db.session.delete(self)
|
||||
db.session.commit()
|
||||
|
||||
@ -528,8 +522,6 @@ class Corpus(db.Model):
|
||||
'files': {file.id: file.to_dict() for file in self.files}}
|
||||
|
||||
def delete(self):
|
||||
for corpus_file in self.files:
|
||||
db.session.delete(corpus_file)
|
||||
db.session.delete(self)
|
||||
db.session.commit()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user