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

Implements #2518 to allow for excluding specific indexes during scaffolding #2520

Merged
merged 1 commit into from
Sep 21, 2024

Conversation

jwyza-pi
Copy link
Contributor

@jwyza-pi jwyza-pi commented Sep 19, 2024

Handles #2518. This works around dotnet/efcore#11298.

Example:

Before:

{
  "name": "[dbo].[Widget]",
  "exclude": false
},
 public void Configure(EntityTypeBuilder<Widget> entity)
  {
      entity.ToTable("Widget", tb =>
          {
              tb.HasTrigger("Widget_Insert");
              tb.HasTrigger("Widget_Update");
          });

      entity.HasIndex(e => new { e.CompanyId, e.IsDeleted, e.WidgetName }, "IX_Widget_CompanyIdIsDeletedWidgetName");

      entity.HasIndex(e => e.CompanyId, "UX_Widget_CompanyId_TopLevelWidget")
          .IsUnique()
          .HasFilter("([ParentWidgetId]=(0) AND [IsDeleted]=(0))");
}

After:

{
  "name": "[dbo].[Folder]",
  "exclude": false,
  "excludedIndexes": [
    "UX_Folder_CompanyId_TopLevelFolder"
  ]
},
 public void Configure(EntityTypeBuilder<Widget> entity)
{
    entity.ToTable("Widget", tb =>
        {
            tb.HasTrigger("Widget_Insert");
            tb.HasTrigger("Widget_Update");
        });
  
    entity.HasIndex(e => new { e.CompanyId, e.IsDeleted, e.WidgetName }, "IX_Widget_CompanyIdIsDeletedWidgetName");
}

@jwyza-pi jwyza-pi marked this pull request as ready for review September 19, 2024 17:56
@ErikEJ
Copy link
Owner

ErikEJ commented Sep 21, 2024

@jwyza-pi Thanks again for another great contribution - I will get the docs updated

@ErikEJ ErikEJ merged commit 63b6722 into ErikEJ:master Sep 21, 2024
2 checks passed
@jwyza-pi jwyza-pi deleted the issue-2518-scaffoldingbug-workaround branch September 23, 2024 12:45
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

Successfully merging this pull request may close these issues.

2 participants