Revert "Remove path_hash everywhere but the DB"

This reverts commit 08b1a93cbaa74b455ea50067921aa10dcc05de79.

We need to do this because we've spotted that we've put a unique
call in the wrong place, leaving an index non-unique. This could
be reverted in a second migration, but we also spotted that
we haven't dealt with the plethora of NULL in the new canonical_path
column that a new UNIQUE would require. At time of commit, this has
only reached preview, so we'll massage the indexes there.