Skip to content

Altering Unique, nullable field to Non-nullable #22

@dcleveng

Description

@dcleveng

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions