Remove migration

This commit is contained in:
Lorenz Padberg 2022-08-03 13:00:21 +02:00
parent 88a9d98c0a
commit 8bba23745a
2 changed files with 7 additions and 24 deletions

View File

@ -1,10 +1,15 @@
from wagtail.documents.models import Document
from .models.custom_document import CustomDocument
def migrate_documents_to_custom_document_model(dryrun=False):
try:
from wagtail.documents.models import Document
all_documents = Document.objects.all()
except Exception as e:
# new databases do not have the table for the standart wagtail documents there fore the migration is not
# necessary. Mainly
return
print(f"Found {all_documents.count()} Documents")
for document in all_documents:

View File

@ -1,22 +0,0 @@
from django.db import migrations
from books.migrate_document_model import migrate_documents_to_custom_document_model
def forwards_func(apps, schema_editor):
migrate_documents_to_custom_document_model()
def reverse_func(apps, schema_editor):
pass
class Migration(migrations.Migration):
dependencies = [
('books', '0035_auto_20220728_0848'),
]
operations = [
migrations.RunPython(forwards_func, reverse_func),
]