I don't think this is the right place to do the database upgrade.  Instead, here is what I recommend.

1) Change MediaDB.VERSION from 2 to 3.
2) Add your upgrade code to the onupgradeneeded callback at line 423

Notice that that callback includes code to delete the database and start over with a fresh scan. That isn't what we want anymore because of data loss for things like music ratings and videos watched.  (The original MediaDB design assumed that only metadata would be stored and that everything could be regenerated by rescanning the filesystem. That isn't true anymore.)

I think you'll want to remove that for loop at line 429 and replace it with something like:

if (existingStoreNames.length && MediaDB.VERSION === 3) {
   // enumerate all records and update any that have relative names
}

Ideally, the client media apps should be given an opportunity to upgrade the file records as well, by passing each one to an options.upgrade() function or something, but that doesn't have to happen as part of this bug.