-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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(sqlite): parse date error #16355
Conversation
DataTypes = require('sequelize/lib/dialects/sqlite/data-types')(BaseTypes); | ||
|
||
if (dialect.match(/^sqlite/)) { | ||
describe('[SQLITE Specific] DataTypes', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these tests really sqlite specific? Is the behaviour different on other dialects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok,Here's what I think。
- I don't know the details of how DATE is handled in other dialects, but it appears from the source code that different dialects handle dates differently from each other.
- the problem I'm having only occurs in sqlite, so I'm just fixing the parse function in sqlite and making sure it's working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the other dialects should also handle these test cases the same way, so I'd like to see these tests running on all dialects and therefore be added to an existing test suite
Can this pr be merged? |
I'm not convinced we should do this. Our Date DataType inserts dates in the ISO format, not as numbers. If the goal is to fix #16340, it's Once that is fixed, any Date persisted to the database as a number will not be caused by us, therefore we can't know what level of precision it is meant to represent. It could be milliseconds, nanoseconds, seconds. You can always extend DATE in your project to suit your needs but I don't think we should apply this to all users |
|
Yes but we're not responsible for the format prisma used, that's what I was saying in my comment above: Prisma chose a precision of milliseconds, but another (or even us) could have chosen a different precision, like nanoseconds. We can't know what the precision should be because we were not responsible for the insertion of the data. This PR is specific to your needs so I would recommend a custom DataType instead (or migrating your data) |
Pull Request Checklist
Description Of Change
Todos