Wrap in db transaction

This commit is contained in:
shamoon 2024-10-27 16:40:26 -07:00
parent fab6535cc7
commit 32f1818cb3

View File

@ -1,6 +1,7 @@
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db import connection from django.db import connection
from django.db import models from django.db import models
from django.db import transaction
from documents.models import Document from documents.models import Document
@ -33,4 +34,5 @@ class Command(BaseCommand):
) )
def handle(self, **options): def handle(self, **options):
with transaction.atomic():
self.convert_field(Document, "transaction_id", null=True) self.convert_field(Document, "transaction_id", null=True)