

def migrate_legacy_obj(legacy_guid_file):
    'Create `OsfStorageGuidFile` object corresponding to provided `OsfGuidFile`\n    object, then set the `referent` of the `Guid` object to the newly created\n    record.\n    '
    logger.info('Migrating legacy Guid {0}'.format(legacy_guid_file._id))
    storage_obj = get_or_create_storage_file(legacy_guid_file.node, legacy_guid_file.name, _id=legacy_guid_file._id)
    guid_obj = Guid.load(legacy_guid_file._id)
    guid_obj.referent = storage_obj
    guid_obj.save()
    return storage_obj

dataset/ETHPy150Open CenterForOpenScience/osf.io/scripts/osfstorage/migrate_guids.py migrate_legacy_obj/original