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

Remove faulty/duplicate CreateIndex #2758

Merged
merged 1 commit into from
Dec 5, 2017
Merged

Conversation

acjh
Copy link
Contributor

@acjh acjh commented Dec 5, 2017

Fixes #2625 (comment):

System.InvalidOperationException: The index with name 'IX_UserId_State_CreationTime' on table 'dbo.AbpUserNotifications' has the same column order of '1' specified for columns 'TenantId' and 'UserId'. Make sure a different order value is used for the IndexAttribute on each column of a multi-column index.

Issue

The index with name 'IX_UserId_State_CreationTime' is created twice for the same entity. The second one wrongly sets an index on e.TenantId, and the same column on e.State and e.CreationTime.

modelBuilder.Entity<UserNotificationInfo>()
.Property(e => e.UserId)
.CreateIndex("IX_UserId_State_CreationTime", 1);
modelBuilder.Entity<UserNotificationInfo>()
.Property(e => e.State)
.CreateIndex("IX_UserId_State_CreationTime", 2);
modelBuilder.Entity<UserNotificationInfo>()
.Property(e => e.CreationTime)
.CreateIndex("IX_UserId_State_CreationTime", 3);

modelBuilder.Entity<UserNotificationInfo>()
.Property(e => e.TenantId)
.CreateIndex("IX_UserId_State_CreationTime", 1);
modelBuilder.Entity<UserNotificationInfo>()
.Property(e => e.State)
.CreateIndex("IX_UserId_State_CreationTime", 2);
modelBuilder.Entity<UserNotificationInfo>()
.Property(e => e.CreationTime)
.CreateIndex("IX_UserId_State_CreationTime", 2);

Fix

I removed the second one.

@hikalkan hikalkan merged commit 0d8c8fb into aspnetboilerplate:dev Dec 5, 2017
@hikalkan hikalkan added the bug label Dec 5, 2017
@hikalkan hikalkan added this to the v3.3 milestone Dec 5, 2017
@hikalkan
Copy link
Member

hikalkan commented Dec 5, 2017

Thanks a lot @acjh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants