Preserve domain records history after domain deletion.

This commit is contained in:
Rauno Tuul
2023-02-13 12:08:03 +02:00
parent c5b9e24604
commit 7221271a7b
3 changed files with 15 additions and 5 deletions

View File

@@ -548,11 +548,12 @@ class Domain(db.Model):
domain.apikeys[:] = []
# Remove history for domain
domain_history = History.query.filter(
History.domain_id == domain.id
)
if domain_history:
domain_history.delete()
if not Setting().get('preserve_history'):
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()