-
Notifications
You must be signed in to change notification settings - Fork 229
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
Removal of NpgsqlIndexBuilderExtensions.HasSortOrder extension breaks old migrations #3421
Comments
@spanevin these APIs have been obsolete for quite a while, I decided to finally remove them in 9.0, to prevent them from showing up for new users etc. It's indeed unfortunate that this causes some breakage for people with much older migrations... Is there some reason that it's not possible to do an automated search-and-replace from HasSortOrder to IsDescending? |
IsDescending is not an extension, it's an instance method of IndexBuilder Unfortunately, NpgsqlIndexBuilderExtensions.HasSortOrder call in generated migrations is not used as an extension which could easily be replaced, but used as a static method call in a separate line
It is not so easy to replace this automatically... |
Yeah, I see - this would require a regular expression search, probably... |
I'm not sure if it can be solved by some generic Regex.Replace() which can cover params [] arguments... (as there can be any number of columns in an index) It looks like it requires some tool which can search for such code, probably using a regex, then parse it and replace code according to the number of columns in the HasIndex arguments list. But it becomes much more complicated if any prettier has been applied to this EF-generated code... No easy generic solution anyway... |
I have a project based on Npgsql6 which uses NpgsqlIndexBuilderExtensions.HasSortOrder extension to specify index sorting.
After upgrading to Npgsql9 I found that it can't be compiled as there is no HasSortOrder extension anymore.
It is not a problem for current version of DbContext, I can change a few lines of code to use IsDescending manually, but there are hundreds of previously generated migrations which use this extension, and they all have to be updated manually as well...
Is there any solution which helps to avoid this issue?
Unfortunately, this change is not mentioned as Breaking Change in any changelog or release notes :(
The text was updated successfully, but these errors were encountered: