-
-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 85 create required attributes on update #96
Issue 85 create required attributes on update #96
Conversation
- user can now choose whether or not to update timestamps specified with the 'timestamps' option (defined when making schema) on update.
Passing null or undefined for the key parameter in Model.update will now have it check default values for those keys before erroring out.
Conflicts: lib/Model.js
First -- Sorry for the delayed response. It looks great. The one thing I'm unsure about is What are your thoughts on changing the |
Setting it to |
Conflicts: lib/Model.js
- Table.js had a deferred rejection with just a string (changed to an error object) - updated model tests to reflect createRequired's default of false
Thanks a bunch for this PR. |
This pull request is meant to address Issue #85. There is a lot going on here...
Model.update
now has a new touch. If you pass anull
orundefined
key, then there is a check for key defaults. If the key attributes have defaults, those will be used. If they don't, then an error is thrown. This check is currently not in place.timestamps
(as defined in the schema) are now updated by default. You can turn this behaviour off by:timestamps
updateTimestamps
option tofalse
But, most importantly, this PR now has the update also conditionally update required attributes. There is one catch though: required attributes that do not have a default value will throw an error on update if no value is provided for them.
I also added some tests for
Module.update