Cannot read property 'fields' of undefined
Hi there love the package.
When a model does not have any previous indexes and I add one i get this error
Cannot read property 'fields' of undefined
I receive this error when I add this in my model. I previously did not have an indexes section in the model.
indexes: [
{
fields: ['email'],
}
]
When a different model already had the indexes section, I can add more indexes and I will create a migration correctly.
I have this issue too, adding a new column and defining some associations caused the problem. @irlanco did you find any solutions?
Found a quick fix for this. In your file _current.json, find the model you're adding the index to, change the indexes value from the empty array to an empty object. Then run the migration command again. For example:
- Change
"indexes": []to"indexes": {} -
sequelize-mig migration:make -n foo