summaryrefslogtreecommitdiffstats
path: root/tools/upgrade
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-10-12 09:59:14 -0500
committerTim Laszlo <tim.laszlo@gmail.com>2012-10-12 09:59:14 -0500
commit1c2b1bc91d802f84e1947dc1748c6eed2932a3d6 (patch)
tree44bfd6fa4cfb07ccc8b37138a1c0d1d05f9d49d1 /tools/upgrade
parentcc2b22be6eac960cab71111e593e63e112669686 (diff)
downloadbcfg2-1c2b1bc91d802f84e1947dc1748c6eed2932a3d6.tar.gz
bcfg2-1c2b1bc91d802f84e1947dc1748c6eed2932a3d6.tar.bz2
bcfg2-1c2b1bc91d802f84e1947dc1748c6eed2932a3d6.zip
migration: fetch metadata in the main query
Diffstat (limited to 'tools/upgrade')
-rwxr-xr-xtools/upgrade/1.3/migrate_dbstats.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/upgrade/1.3/migrate_dbstats.py b/tools/upgrade/1.3/migrate_dbstats.py
index 3ebe764c5..3944eb1d3 100755
--- a/tools/upgrade/1.3/migrate_dbstats.py
+++ b/tools/upgrade/1.3/migrate_dbstats.py
@@ -54,11 +54,11 @@ def _migrate_transaction(inter, entries):
modified_count=inter.modified_entries,
extra_count=inter.extra_entries)
- try:
+ if inter.metadata:
newint.profile_id = inter.metadata.profile.id
groups = [grp.pk for grp in inter.metadata.groups.all()]
bundles = [bun.pk for bun in inter.metadata.bundles.all()]
- except legacy_models.InteractionMetadata.DoesNotExist:
+ else:
groups = []
bundles = []
unkown_profile = cache.get("PROFILE_UNKNOWN")
@@ -224,7 +224,7 @@ def _restructure():
int_count = legacy_models.Interaction.objects.count()
int_ctr = 0
for inter in BatchFetch(legacy_models.Interaction.objects.\
- select_related().all()):
+ select_related('metadata', 'client').all()):
if int_ctr % 1000 == 0:
logger.info("Migrated %s of %s interactions" % (int_ctr, int_count))
try: