Skip to content
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

Use order-agnostic comparison for JSON #383

Closed
wants to merge 1 commit into from

Conversation

fyrts
Copy link

@fyrts fyrts commented Oct 6, 2020

The current implementation for dealing with MySQL reordering of JSON keys assumes that MySQL sorts the keys alphabetically, which isn't always the case.

From the MySQL documentation:

To make lookups more efficient, it also sorts the keys of a JSON object. You should be aware that the result of this ordering is subject to change and not guaranteed to be consistent across releases.

I've changed the preSave method to ignore any differences in order by comparing sorted versions of the original and changed JSON data.

@fyrts fyrts closed this Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant