Throw exception on case-insensitive duplicate IDs#49
Merged
Conversation
eldadfux
requested changes
Aug 10, 2021
Member
|
I think we need the same implementation for indexes as well if we don't have it yet. |
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.
MongoDB document keys are case sensitive, but MariaDB column names are not.
This PR adds a case-insensitive check when creating attributes/indexes or adding one to the queue, and will throw
Utopia\Database\Exception\Duplicateif a match is found.This PR also changes the default index on
_uidfor the MongoDB adapter to be case-insensitive.Testing
Tests have been added to catch these exceptions.
Unanswered questions
When adding attributes to a collection, the attribute document is appended to$attribute->getAttribute('attributes'), and when fetched, returnsDocument[] $attributes. However, when adding all attributes at once viacreateCollection, I receive just a plain array, not a Document. I had to hack around this problem, and I would like to not have to do this: