Removal of the unnecessary method remove_number_of_pages_to_pages_count in the migration

This commit is contained in:
s0llvan 2024-09-24 18:15:38 +02:00 committed by GitHub
parent ea7bd0bb21
commit f855f5c29e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,17 +40,6 @@ def add_number_of_pages_to_pages_count(apps, schema_editor):
print(f"Error retrieving number of pages for {doc.filename}: {e}") print(f"Error retrieving number of pages for {doc.filename}: {e}")
def remove_number_of_pages_to_pages_count(apps, schema_editor):
Document = apps.get_model("documents", "Document")
if not Document.objects.all().exists():
return
for document in Document.objects.filter(mime_type="application/pdf"):
document.pages_count = 0
document.save()
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
("documents", "1052_document_transaction_id"), ("documents", "1052_document_transaction_id"),
@ -69,6 +58,6 @@ class Migration(migrations.Migration):
), ),
migrations.RunPython( migrations.RunPython(
add_number_of_pages_to_pages_count, add_number_of_pages_to_pages_count,
remove_number_of_pages_to_pages_count, migrations.RunPython.noop,
), ),
] ]