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

Index reported as Extra in Database, but it is also in the model. #33

Open
urielzen opened this issue Nov 27, 2023 · 2 comments
Open

Index reported as Extra in Database, but it is also in the model. #33

urielzen opened this issue Nov 27, 2023 · 2 comments

Comments

@urielzen
Copy link

Hi, I am using SQL Server, and I am getting the following errors.

EXTRA IN DATABASE: Index 'AuthorityStandards', index constraint name. Found = IX_AuthorityStandards_ExtId
EXTRA IN DATABASE: Index 'AuthorityStandards', index constraint name. Found = IX_AuthorityStandards_GradeLevelId
EXTRA IN DATABASE: Index 'AuthorityStandards', index constraint name. Found = IX_AuthorityStandards_SubjectId
EXTRA IN DATABASE: Index 'AuthorityStandards', index constraint name. Found = IX_AuthorityStandards_AuthorityId_SubjectId_GradeLevelId_Name_YearAdopted

My entity class is decorated accordingly

image

The GradeLevelId and SubjectId are there because they are FK to another table.

image

As I was writing this bug report I thought that maybe this had to do with another bug report I created earlier.
Errors when using JSON columns

Since the error in both bug reports happen to be in tables where both have a JSON column. So I went ahead and removed the JSON column with a migration from this table AuthorityStandards and the error reported above went away! In other words these errors are reported only when there is a JSON column present in the table.

I hope this helps

@CSharpFiasco
Copy link

CSharpFiasco commented Feb 23, 2024

I have a similar issue when I use a value object. The error message I get is:

EXTRA IN DATABASE: Index 'Order', index constraint name. Found = IX_Order_CustomerId

I have simplified my project and recreated this issue here. I subsequently created another branch which removed the ShippingAddress field off of the Order entity here. The unit test that does the comparison succeeds when I remove the ShippingAddress field

By the way, here is some information on my system

I am using:

  • EfCore.SchemaCompare 8.0.1

  • Visual Studio 2022 Version 17.8.7

  • SQL Server 15 (the tests write to the (localdb)\mssqllocaldb)

  • EF Core 8

@JonPSmith
Copy link
Owner

Hi @urielzen,

Do try version 8.1.0, which supports Json Mapping, and close this if it works. Thanks.

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

3 participants