diff --git a/dandiapi/api/migrations/0013_garbagecollectionevent.py b/dandiapi/api/migrations/0013_garbagecollectionevent.py index 8f3ca9bef..75a91d649 100644 --- a/dandiapi/api/migrations/0013_garbagecollectionevent.py +++ b/dandiapi/api/migrations/0013_garbagecollectionevent.py @@ -1,4 +1,4 @@ -# Generated by Django 4.1.13 on 2024-11-25 20:12 +# Generated by Django 4.1.13 on 2024-12-04 19:51 from __future__ import annotations from django.db import migrations, models @@ -19,7 +19,7 @@ class Migration(migrations.Migration): auto_created=True, primary_key=True, serialize=False, verbose_name='ID' ), ), - ('created', models.DateTimeField(auto_now_add=True)), + ('timestamp', models.DateTimeField(auto_now_add=True)), ( 'type', models.CharField( @@ -38,8 +38,8 @@ class Migration(migrations.Migration): 'garbage_collection_event_id', models.UUIDField( editable=False, - help_text='Unique identifier for the garbage collection event.' - ' Used to associate multiple records that are part of the same GC event.', + help_text='Unique identifier for the garbage collection event. Used to ' + 'associate multiple records that are part of the same GC event.', ), ), ], diff --git a/dandiapi/api/models/garbage_collection.py b/dandiapi/api/models/garbage_collection.py index 790f758a9..be1619c1c 100644 --- a/dandiapi/api/models/garbage_collection.py +++ b/dandiapi/api/models/garbage_collection.py @@ -4,7 +4,7 @@ class GarbageCollectionEvent(models.Model): - created = models.DateTimeField(auto_now_add=True) + timestamp = models.DateTimeField(auto_now_add=True) type = models.CharField( max_length=255, help_text='The model name of the records that were garbage collected.' ) diff --git a/dandiapi/api/services/garbage_collection/__init__.py b/dandiapi/api/services/garbage_collection/__init__.py index 4e4296b15..6d5c203b4 100644 --- a/dandiapi/api/services/garbage_collection/__init__.py +++ b/dandiapi/api/services/garbage_collection/__init__.py @@ -91,7 +91,7 @@ def garbage_collect(): garbage_collected_asset_blobs = _garbage_collect_asset_blobs() GarbageCollectionEvent.objects.filter( - created__lt=timezone.now() - RESTORATION_WINDOW + timestamp__lt=timezone.now() - RESTORATION_WINDOW ).delete() logger.info('Garbage collected %s Uploads.', garbage_collected_uploads)