stash
Some checks failed
/ test (push) Successful in 50s
/ deploy (push) Failing after 3m28s

This commit is contained in:
j3d1 2024-11-22 00:22:11 +01:00
parent 0eaff2266c
commit 351d5127bd
2 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,22 @@
# Generated by Django 4.2.7 on 2024-11-21 22:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('files', '0002_alter_file_file'),
]
def set_creation_date(apps, schema_editor):
File = apps.get_model('files', 'File')
for file in File.objects.all():
if file.created_at is None:
if not file.item.created_at is None:
file.created_at = file.item.created_at
else:
file.created_at = max(File.objects.filter(id__lt=file.id).values_list('created_at', flat=True))
operations = [
migrations.RunPython(set_creation_date),
]