Skip to content

Migration: Make existing column which has a unique index nullable fails  #25083

Open

Description

Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: NET 5.0

When creating a unique index on a nullable column, the index is created with a 'where not null' clause. If however the column is not nullable, this is of course omitted. I'm now trying to change a column from 'not nullable' to 'nullable', containing such an index. This fails because the index isn't being altered either.

Microsoft.Data.SqlClient.SqlException
  HResult=0x80131904
  Message=The index 'UX_***************' is dependent on column '********'.
ALTER TABLE ALTER COLUMN *********** failed because one or more objects access this column.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions