maritz / nohm

node.js object relations mapper (orm) for redis
http://maritz.github.io/nohm/
MIT License
500 stars 64 forks source link

New property doesn't get added to redis hash on update #185

Open maritz opened 2 years ago

maritz commented 2 years ago

When adding a new property that has a defaultValue (or setting it to null when no defaultValue is set) to an existing model instance and then saving it (so it's an update, not a create), the value is not written to the DB.

This causes issues with indexing down the line, at the very least.

As a temporary workaround, one needs to add a migration that first sets the value to a non-default on all existing instances and then sets the default again.