Update index.js

fixing to test for issue where db.models is undefined, fallback to original model lookup. It seems that db.models is only created when the connection is explicitly created.