def enrich_dblog_metadata(apps, _):
    """
    Add objpk and objname to the DbLog table metadata.
    """
    import json
    DbLog = apps.get_model('db', 'DbLog')
    query_set = DbLog.objects.all()
    for log in query_set.iterator():
        met = json.loads(log.metadata)
        if 'objpk' not in met:
            met['objpk'] = log.objpk
        if 'objname' not in met:
            met['objname'] = log.objname
        log.metadata = json.dumps(met)
        log.save(update_fields=['metadata'])
