diff --git a/helios/migrations/0003_v3_1_election_specific_voters_with_passwords.py b/helios/migrations/0003_v3_1_election_specific_voters_with_passwords.py index 518356d70e15f82fd1ce84841ebb24031605fe6f..008c9c6242b69866f1e03eff8e9df4e0a53ac931 100644 --- a/helios/migrations/0003_v3_1_election_specific_voters_with_passwords.py +++ b/helios/migrations/0003_v3_1_election_specific_voters_with_passwords.py @@ -16,7 +16,9 @@ class Migration(DataMigration): e.datatype = 'legacy/Election' e.save() - for v in orm.Voter.objects.all(): + # use the .iterator() call to reduce caching and make this more efficient + # so as not to trigger a memory error + for v in orm.Voter.objects.all().iterator(): user = orm['auth.User'].objects.get(user_type = v.voter_type, user_id = v.voter_id) if v.voter_type == 'password':