delete history records when a domain is deleted (#916)

Co-authored-by: Jody <jody.gilbert@edftrading.com>
This commit is contained in:
jodygilbert 2021-05-07 21:55:45 +01:00 committed by GitHub
parent 5f10f739ea
commit b66b37ecfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -519,6 +519,13 @@ class Domain(db.Model):
domain_setting.delete()
domain.apikeys[:] = []
# Remove history for domain
domain_history = History.query.filter(
History.domain_id == domain.id
)
if domain_history:
domain_history.delete()
# then remove domain
Domain.query.filter(Domain.name == domain_name).delete()
if do_commit: