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

Fix compound indexes for dynamic models #421

Merged
merged 1 commit into from
Jul 20, 2021

Conversation

xquezme
Copy link
Contributor

@xquezme xquezme commented Apr 5, 2021

Right now if you try to create any compound index for core store dynamic model you will receive syntax error. This because "-" is prohibited and caused syntax error. For instance, for Dog model in DynamicModelTests.swift you will receive this error:

near "-": syntax error in "CREATE INDEX IF NOT EXISTS Z_Dog__CoreStoreSchema_indexes_Dog_age-nickname ON ZANIMAL (ZAGE COLLATE BINARY ASC, ZNICKNAME COLLATE BINARY ASC)

Let's use "_" instead.

@xquezme
Copy link
Contributor Author

xquezme commented May 17, 2021

@JohnEstropia Can you take a look, please?

@JohnEstropia
Copy link
Owner

@xquezme Thanks for this PR and apologies for not responding here sooner, but I did check your PR and acknowledge the issue.
I've been meaning to look for a formal fix for this, but haven't found time yet to do a full test on the behavior.

The reason I can't merged the PR as it is now is because unfortunately, the current NSFetchIndexDescription.name actually works for single-indexes. By changing the naming now, it might break existing apps that use the current naming. I'll get to a formal fix and unit tests for it once I release the Swift 5.5/Xcode 13 update, but if you find a solution ahead feel free to update the PR.

@JohnEstropia JohnEstropia merged commit 5fbb1ab into JohnEstropia:develop Jul 20, 2021
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.

2 participants