The unique key on <documentPHID, version> may fail to apply if any content rows don't have a valid document. This is rare, but we have some old random garbage rows on "secure.phabricator.com" which prevent the next patch from applying. Just toss these rows, they're junk.