Remove history for UsageTrack
This commit is contained in:
parent
1ae93791f9
commit
0c184e9b1d
|
@ -165,8 +165,6 @@ class UsageTrack(models.Model):
|
||||||
start_time = models.DateTimeField(auto_now_add=True)
|
start_time = models.DateTimeField(auto_now_add=True)
|
||||||
num_seconds = models.IntegerField()
|
num_seconds = models.IntegerField()
|
||||||
|
|
||||||
history = HistoricalRecords(excluded_fields=['num_seconds'])
|
|
||||||
|
|
||||||
class HistoryIndex(models.Model):
|
class HistoryIndex(models.Model):
|
||||||
content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL)
|
content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL)
|
||||||
object_id = models.PositiveIntegerField()
|
object_id = models.PositiveIntegerField()
|
||||||
|
|
13
apiserver/delete_usagetracks.py
Executable file
13
apiserver/delete_usagetracks.py
Executable file
|
@ -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')
|
Loading…
Reference in New Issue
Block a user