From f855f5c29e66d181a61aa28479abfcb96dd2bbd4 Mon Sep 17 00:00:00 2001 From: s0llvan <178677095+s0llvan@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:15:38 +0200 Subject: [PATCH] Removal of the unnecessary method remove_number_of_pages_to_pages_count in the migration --- .../migrations/1053_document_pages_count.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/documents/migrations/1053_document_pages_count.py b/src/documents/migrations/1053_document_pages_count.py index a6caa789d..2d8e7bb37 100644 --- a/src/documents/migrations/1053_document_pages_count.py +++ b/src/documents/migrations/1053_document_pages_count.py @@ -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}") -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): dependencies = [ ("documents", "1052_document_transaction_id"), @@ -69,6 +58,6 @@ class Migration(migrations.Migration): ), migrations.RunPython( add_number_of_pages_to_pages_count, - remove_number_of_pages_to_pages_count, + migrations.RunPython.noop, ), ]