sequelize-auto
sequelize-auto copied to clipboard
Request: leave out 'defaultValue' from generated models (optional?)
We already have declared default values for some columns in db.
When creating records, sequelize.create()
doesn't specify columns if they are not set to a specific value, which is great. Columns will be set to defaults set in db.
Models generated by sequelize-auto
read that default value and include it in model definition. This is undesired behavior. It also
- introduces more complexity (leading to many issues with
defaultValue
: https://github.com/sequelize/sequelize-auto/search?q=defaultvalue&type=issues) - duplicates default value. Updating a column default value now also requires updating js models. We had bugs due to updating db defaults in production, but missed updating js models.
Please leave out 'defaultValue' from generated models, or have an option for it to be left out. Thanks!
@steveschmitt What do you think? Now, every time we re-generate models we need to remove default values for everything to work properly.
I got the same problem