Remove migration
This commit is contained in:
parent
88a9d98c0a
commit
8bba23745a
|
|
@ -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):
|
||||
all_documents = Document.objects.all()
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
]
|
||||
Loading…
Reference in New Issue