Skip to content

Commit

Permalink
Added function to purge all data of a project.
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Feb 11, 2020
1 parent 68d14b5 commit 4812057
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions maintainer/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,20 @@ def update_data(self):
self.last_update = timezone.now()
self.save()

def purge_data(self):
from core.models import Metric, Release, Usage
from ingest.models import Complexity, OpenIssue, RawCodeChange, RawIssue

Release.objects.filter(project=self).delete()
Metric.objects.filter(project=self).delete()
OpenIssue.objects.filter(project=self).delete()
RawCodeChange.objects.filter(project=self).delete()
RawIssue.objects.filter(project=self).delete()
Complexity.objects.filter(project=self).delete()
self.source_tree_metrics = {}
self.last_update = None
self.save()

def clone_repo(self):
from ingest.tasks.git import clone_repo
clone_repo(
Expand Down

0 comments on commit 4812057

Please sign in to comment.