Skip to content

Commit

Permalink
Task to migrate from old to new reference structure | added logs
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Jul 6, 2022
1 parent 5e08546 commit 4388a8d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/common/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,13 @@ def reference_old_to_new_structure():
from core.collections.parsers import CollectionReferenceExpressionStringParser
from core.collections.models import CollectionReference

for reference in CollectionReference.objects.filter(
expression__isnull=False, system__isnull=True, valueset__isnull=True):
logger.info('Migrating %s', reference.uri)
queryset = CollectionReference.objects.filter(expression__isnull=False, system__isnull=True, valueset__isnull=True)
total = queryset.count()
logger.info('Need to migrate %d references', total)
count = 1
for reference in queryset:
logger.info('(%d/%d) Migrating %s', count, total, reference.uri)
count += 1
parser = CollectionReferenceExpressionStringParser(expression=reference.expression)
parser.parse()
ref_struct = parser.to_reference_structure()[0]
Expand Down

0 comments on commit 4388a8d

Please sign in to comment.