From fd4875818f0a6d1b5c3d56ab373cf92640343b14 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Wed, 22 Jun 2016 16:06:47 -0400 Subject: [PATCH] do not drop mongo after migration --- awx/main/migrations/_system_tracking.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/main/migrations/_system_tracking.py b/awx/main/migrations/_system_tracking.py index 6c269275b5..d39e99888f 100644 --- a/awx/main/migrations/_system_tracking.py +++ b/awx/main/migrations/_system_tracking.py @@ -35,6 +35,10 @@ def migrate_facts(apps, schema_editor): # TODO: This means the database was up but something happened when we tried to query it return (0, 0) + # Migration already happened + if Fact.objects.all().count() > 0: + return (migrated_count, not_migrated_count) + migrated_count = 0 not_migrated_count = 0 transform = KeyTransform([('.', '\uff0E'), ('$', '\uff04')]) @@ -49,5 +53,4 @@ def migrate_facts(apps, schema_editor): # This isn't a hard error. Just something the user would want to know. not_migrated_count += 1 - drop_system_tracking_db() return (migrated_count, not_migrated_count)