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

Altering Unique, nullable field to Non-nullable #22

Closed
dcleveng opened this issue Mar 31, 2021 · 4 comments
Closed

Altering Unique, nullable field to Non-nullable #22

dcleveng opened this issue Mar 31, 2021 · 4 comments

Comments

@dcleveng
Copy link

This has been an on-going issue with the Django MSSQL backend. I've experienced it on more than one occasion in my own code and third party modules, the most recent occurring when attempting to integrating djangorestframework-api-key into an existing project.

Running migrations on the newly installed module results in the following failure:

django.db.utils.ProgrammingError: ('42S11', "[42S11] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The operation failed because an index or statistics with name 'rest_framework_api_key_apikey_prefix_4e0db5f8_uniq' already exists on table 'rest_framework_api_key_apikey'. (1913) (SQLExecDirectW)")

On closer inspection one of the migrations is altering a field from unique=True, null=True to a unique nullable field. Typically, if I run into this issue in my own code, I'll just work around it and make the necessary changes. In this case, I'm concerned about future compatibility issues with the djangorestframework-api-key down the road if I make those changes myself.

Some additional info from the forked project can be found here: ESSolutions/django-mssql-backend#77

@absci
Copy link
Contributor

absci commented Apr 1, 2021

Thanks for this report, we will review the issue and existing PR from ESSolutions/django-mssql-backend#77.

@lendenmc
Copy link

lendenmc commented Jun 30, 2022

Thanks for this report, we will review the issue and existing PR from ESSolutions/django-mssql-backend#77.

Hello, any plan any time soon for the existing PR ? I am also running into the same error within the same context:

django.db.utils.ProgrammingError: ('42S11', "[42S11] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]The operation failed because an index or statistics with name 'rest_framework_api_key_apikey_prefix_8i9pw3z1_uniq' already exists on table 'rest_framework_api_key_apikey'. (1913) (SQLExecDirectW)")

@massoudrahimzadeh
Copy link

I have the same issue, following..

@jmah8
Copy link
Contributor

jmah8 commented Aug 18, 2022

This issue should be fixed by PR #163. I am going to close this issue but if you are still having the same issue feel free to reopen this issue.

@jmah8 jmah8 closed this as completed Aug 18, 2022
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

No branches or pull requests

5 participants