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
fix(model): handle true
timestamp fields correctly
#12580
Conversation
Updated Model.init method to accept only string and boolean values. Also, prevent a column named `true` from being created on the model whenever any timestamp fields (viz. 'createdAt', 'updatedAt', 'deletedAt') is set to `true` Closes sequelize#12551
Added tests to check the following: - Model.init throws Error when any timestamp field has value other than string or boolean - Model.init doesn't create a column named `true` when any timestamp field is set to true
Codecov Report
@@ Coverage Diff @@
## master #12580 +/- ##
==========================================
- Coverage 96.33% 95.85% -0.48%
==========================================
Files 95 92 -3
Lines 9256 9057 -199
Branches 90 90
==========================================
- Hits 8917 8682 -235
- Misses 322 358 +36
Partials 17 17
Continue to review full report at Codecov.
|
true
true
timestamp fields correctly
Hello! I see you are a first-time contributor, thank you for taking the time to help Sequelize! I hope to see more PRs from you in the future! Fantastic work!! |
Co-authored-by: Pedro Augusto de Paula Barbosa <papb1996@gmail.com>
Co-authored-by: Pedro Augusto de Paula Barbosa <papb1996@gmail.com> Co-authored-by: Vishal Sood <vishalsood1995@gmail.com>
Pull Request check-list
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description of change
Model
.init
method to accept onlystring
andboolean
values for the timestamp fields; throw anError
if some other value is passed"true"
from being created on the model whenever any timestamp fields (viz.createdAt
,updatedAt
,deletedAt
) is set totrue
Fixes #12551