Media objects should always have a ref. If the database gets into a state where a media object is missing a ref (corruption, media object failed in the past etc) the migration of data to the upgraded database will fail.
The media objects missing refs are not practically usable, so we should set the ref to a blank string to permit the migration to succeed.