Repository navigation
Fix timestamp() setting a key named "null" in some cases - #1820
Merged
Merged
Conversation
- This would only happen if the user had set a custom value for hasTimestamps that included a literal null value for the updated_at key.
|
If we give only created_at attribute in the array it is taking undefined in the insert query instead of updated_at. For example For above model declaration the query is going like If we give like Then the query is going like So, I have given false value for the > hasTimestamps then it is working. |
Member
Author
|
Have you tried the code that is in this change or are you referring only to the published version 0.13.3? |
|
I am referring the published version bookshelf@0.13.3 only.
…On Thu, Jun 14, 2018 at 4:38 PM, Ricardo Graça ***@***.***> wrote:
Have you tried the code that is in this change or are you referring only
to the published version 0.13.3?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1820 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AlchsrdzscGFrlb-xiHeclrQQbuuKeiAks5t8kQzgaJpZM4Tfmw6>
.
--
Thanks & Regards,Meda AmaranadhSr.Software Development Engineer
------------------------------
westagilelabs.com LinkedIn <https://www.linkedin.com/in/thisisamar/>
|
Member
Author
|
This PR you're commenting on fixes that then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduction
The previous PR introduced a bug where a model could end up with a key named "null" if the user specified a custom
hasTimestampsvalue that included a literalnullas the second key name. This would lead to a SQL error complaining about a nonexistent column named "null" or "undefined".Proposed solution
This checks if a
updatedAtkey exists first before attempting any other comparisons. The problem was in the first condition that would incorrectly returntrueif the key hadn't been set, even though it should only be checking if it had been set by the user.