Fix adding an index when a relationship is created