Correct logic for by_model_type (STI) edge case where unique index should not be used