-
Notifications
You must be signed in to change notification settings - Fork 9
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
Duplicate Entry due to Short Index #9
Comments
Hi, Initially I thought that MySQL has a size limitation of composite keys at 64 characters. Later I found this ticket and the related PR as well.
I do not know this codebase enough, is it really needed to truncate the composite key's building blocks? EDIT
I suggest the following migration script to handle the issue:
Suggestion for fix: #19 |
Due to this code snippet:
https://github.com/Cvmcosta/ltijs-sequelize/blob/master/src/DB.js#L298-L313
We are getting "Duplicate Entry" errors.
When a call to
getLineitems
is called, it gets an access token with the scopehttps://purl.imsglobal.org/spec/lti-ags/scope/lineitem.raedyOnly
. Trucating this at50
chars is ``.Next, if you try and send a score, the following logic/issue happens:
https://purl.imsglobal.org/spec/lti-ags/scope/lineitem https://purl.imsglobal.org/spec/lti-ags/scope/score
. It so it fetches a new access token.scope
field ofhttps://purl.imsglobal.org/spec/lti-ags/scope/lineitem https://purl.imsglobal.org/spec/lti-ags/scope/score
.UNIQUE
onplatformUrl, clientId, scopes
. But because the index truncates the cope to 50, these 2 different scopes are seen as the same:Suggested Fix
A new column named
token_hash
oraccess_token_hash
that is an md5 of the 3 fields (platformUrl, clientId, scopes) and that is used for the unique check.Steps to reproduce
/send-grade
The text was updated successfully, but these errors were encountered: