Steps to reproduce
- create a model with a property name that contains an underscore in it (e.g. short_name).
- set that property to be indexed (e.g.
"index": true)
- call
pg.autoupdate() (e.g. where app.datasources.pg);
Current Behavior
- The index is added
- Then the index is dropped
Expected Behavior
- The index is added
Additional information
The bug shown here is a bad regular expression in migration.js (on or about line 777):
const propNameRegEx = new RegExp('^' + self.table(model) + '_([^_]+)_idx');
The simple fix is:
const propNameRegEx = new RegExp('^' + self.table(model) + '_(.*)(?:_idx)$');