You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue is regarding this section.
Silencing typing errors regarding timestamps via specifying them in init method changes the created table schema. By default, timestamp fields created by sequelize are non nullable, but when we specify them to silence the error, timestamps are created as nullable fields.
Snippet:
Timestamp attributes managed by Sequelize (by default, createdAt, updatedAt, and deletedAt) don't need to be configured using Model.init, unfortunately Model.init has no way of knowing this. We recommend you use the minimum necessary configuration to silence this error:
User.init({// technically, `createdAt` & `updatedAt` are added by Sequelize and don't need to be configured in Model.init// but the typings of Model.init do not know this. Add the following to mute the typing error:createdAt: DataTypes.DATE,updatedAt: DataTypes.DATE,},{ sequelize });
What was unclear/insufficient/not covered in the documentation
Current documentation misleads the user into thinking that specifying timestamp fields, does not affect runtime behavior, and is only to silence typescript.
If possible: Provide some suggestion on how we can enhance the docs
I'm not sure if this is a documentation or code error, but it if the problem is on documentation side, it should be fixed as
Issue Description
Issue is regarding this section.
Silencing typing errors regarding timestamps via specifying them in
init
method changes the created table schema. By default, timestamp fields created by sequelize are non nullable, but when we specify them to silence the error, timestamps are created as nullable fields.Snippet:
What was unclear/insufficient/not covered in the documentation
Current documentation misleads the user into thinking that specifying timestamp fields, does not affect runtime behavior, and is only to silence typescript.
If possible: Provide some suggestion on how we can enhance the docs
I'm not sure if this is a documentation or code error, but it if the problem is on documentation side, it should be fixed as
The text was updated successfully, but these errors were encountered: