Skip to content
Snippets Groups Projects
Commit 6f842a10 authored by Stephan Porada's avatar Stephan Porada :speech_balloon:
Browse files

Remove unnecessary deletes which hare handled by cascade options

parent 22114dd4
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment