diff --git a/apiserver/apiserver/api/models.py b/apiserver/apiserver/api/models.py index 0a9517b..021821d 100644 --- a/apiserver/apiserver/api/models.py +++ b/apiserver/apiserver/api/models.py @@ -165,8 +165,6 @@ class UsageTrack(models.Model): start_time = models.DateTimeField(auto_now_add=True) num_seconds = models.IntegerField() - history = HistoricalRecords(excluded_fields=['num_seconds']) - class HistoryIndex(models.Model): content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL) object_id = models.PositiveIntegerField() diff --git a/apiserver/delete_usagetracks.py b/apiserver/delete_usagetracks.py new file mode 100755 index 0000000..c45e8c0 --- /dev/null +++ b/apiserver/delete_usagetracks.py @@ -0,0 +1,13 @@ +import django, sys, os +os.environ['DJANGO_SETTINGS_MODULE'] = 'apiserver.settings' +django.setup() + +from apiserver.api import models + +indexs = models.HistoryIndex.objects.filter(object_name='UsageTrack') +count = indexs.delete() +print(count, 'indexs deleted') + +changes = models.HistoryChange.objects.filter(field='num_seconds') +count = changes.delete() +print(count, 'changes deleted')