mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Merge pull request #18929 from netbox-community/18928-housekeeping-changelog-cleanup
Fixes #18928: Fix support for cascading deletions when cleaning up expired changelog records
This commit is contained in:
commit
c50b1c989d
@ -5,7 +5,6 @@ import requests
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import DEFAULT_DB_ALIAS
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ class Command(BaseCommand):
|
|||||||
ending=""
|
ending=""
|
||||||
)
|
)
|
||||||
self.stdout.flush()
|
self.stdout.flush()
|
||||||
ObjectChange.objects.filter(time__lt=cutoff)._raw_delete(using=DEFAULT_DB_ALIAS)
|
ObjectChange.objects.filter(time__lt=cutoff).delete()
|
||||||
if options['verbosity']:
|
if options['verbosity']:
|
||||||
self.stdout.write("Done.", self.style.SUCCESS)
|
self.stdout.write("Done.", self.style.SUCCESS)
|
||||||
elif options['verbosity']:
|
elif options['verbosity']:
|
||||||
|
Loading…
Reference in New Issue
Block a user