Checks if relationship index exists before creating.

I just wanted to do a pull request for this to see if you think this works.