I have seen multiple JavaScript examples of using createIndex to define an ObjectStore index directly after the ObjectStore has been created like this:
You do it during onupgradeneeded, which should be the same place you are making the object store in the first place. In there, you can do whatever appropriate action is needed to upgrade it, such as creating a new index. Here is an example.