-
-
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
Allow querying local indexes and resolve problem with using updatedAt as range key in a query. #442
Conversation
Pull Request Test Coverage Report for Build 676
💛 - Coveralls |
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.
Mainly questions here. I'd like to get this approved once we verify everything, and once we do, I'll submit a release shortly after.
@yokkoyokko Mind taking a look at this and submitting a GitHub review? |
@dolsem In terms of the following.
I don't think this is an issue or a breaking change. Did the If you could, it'd be amazing if you could write a test to ensure that I really appreciate your work on this. Thank you so much!!! |
@fishcharlie This last test you had questions about already checks for that (perhaps somewhat implicitly), that's why I use updatedAt as a local index. The test currently fails. If you change that to createdAt (which doesn't get updated with |
@dolsem Got it. Looks like there are still some comments from my review that I don't think have been addressed yet. |
@dolsem What do you think? Think we are ready to merge in and get a release out? |
@fishcharlie yes, I believe so. |
@dolsem Thanks again for your work on this. My goal is since version 1.0.0 was such a massive update to provide bug updates ASAP for the next little bit for things that broke in version 1.0.0 that were working before version 1.0.0. Therefor version 1.0.1 has been released that includes this fix!! Please keep filing issues if you notice any other problems and we will work to get them out as soon as possible. |
No problem, glad I could help! |
Summary:
This PR fixes the issue discussed in #439, and one more bug:
toDynamo
method of Attribute is called withoutupdateTimestamps
option set tofalse
duringQuery.exec()
, so whenupdatedAt
timestamp is used as a range key in a query, supplied value gets substituted with current timestamp.I also moved the debug statement for global secondary index, because local secondary index passes that outer check too.
GitHub linked issue:
Closes #439
Other information:
I took the liberty of updating existing tests that were doing nothing meaningful instead of creating new ones. Let me know if you want me to resort to a more conservative option and just define my own tests. However, please note that test
Query with Local Global Index as range
(I assumed there's a typo in the name) currently queries a global index, not a local one, while testShould allow multiple local indexes and query correctly
in its current state should fail as it doesn't even make sense conceptually (local indexes can't have their own range keys and it doesn't make sense for the same attribute to be the key of multiple local indexes). Moreover, the schema defined in that test most likely ends up being unused (which might be why it doesn't fail), because instead of creating a new table it tries to overwrite the one created by the previous test (Log-1
) and likely fails silently, because you cannot add / remove local indexes for an existing table, you have to create a new one.I marked this as a breaking change, however, if we assume that no one used the fact that updatedAt value was changed during a query as a "feature", it shouldn't break any code.
Type (select 1):
Is this a breaking change? (select 1):
Is this ready to be merged into Dynamoose? (select 1):
Are all the tests currently passing on this PR? (select 1):
Other:
npm test
from the root of the project directory to ensure all tests continue to pass