coresmart / persistencejs

persistence.js is an asynchronous Javascript database mapper library. You can use it in the browser, as well on the server (and you can share data models between them).
http://persistencejs.org
1.73k stars 240 forks source link

Support creating composite indexes in migrations #193

Open tiagoengel opened 7 years ago

tiagoengel commented 7 years ago

There's no support for creating composite indexes (indexes on multiple columns) in migrations, unless using raw sql.

I think the addIndex function should accept a string (like today) or an array in the column param.

The addIndex and the removeIndex functions need to be changed to support this.

The persistence.store.websql module already supports composite indexes in the createIndex function. The addIndex implementation could be very similar to that.