From 1958883a97ab735707c83f10799e5cb19bb5638a Mon Sep 17 00:00:00 2001
From: Dan Braghis <dan.braghis@torchbox.com>
Date: Wed, 28 Feb 2018 11:48:19 +0000
Subject: [PATCH] Wrap migrate command in transaction

---
 opentech/apply/users/management/commands/migrate_users.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/opentech/apply/users/management/commands/migrate_users.py b/opentech/apply/users/management/commands/migrate_users.py
index 9e13f18e6..eafd1d086 100644
--- a/opentech/apply/users/management/commands/migrate_users.py
+++ b/opentech/apply/users/management/commands/migrate_users.py
@@ -3,6 +3,7 @@ import json
 
 from django.contrib.auth import get_user_model
 from django.core.management.base import BaseCommand
+from django.db import transaction
 
 
 class Command(BaseCommand):
@@ -17,6 +18,7 @@ class Command(BaseCommand):
             help='Perform a run dry-run',
         )
 
+    @transaction.atomic
     def handle(self, *args, **options):
         with options['source'] as json_data:
             User = get_user_model()
-- 
GitLab