Unable to create index because of duplicate that doesn't exist?

后端 未结 5 1970
眼角桃花
眼角桃花 2021-02-03 17:19

I\'m getting an error running the following Transact-SQL command:

CREATE UNIQUE NONCLUSTERED INDEX IX_TopicShortName
ON DimMeasureTopic(TopicShortName)
         


        
5条回答
  •  深忆病人
    2021-02-03 18:00

    If you are using code-based migrations, and you rename a property of an entity and you are having an unique index for the property, entity framework will create a new column and trying to add an unique index for the new column but the new column has all null values, therefore it will fail. You need to manually modify the migration code to copy the data from old column before the line to create index.

提交回复
热议问题