1
0
mirror of https://github.com/bitwarden/server synced 2025-12-25 20:53:16 +00:00

[BEEEP] [SM-1059] Add missing auth table indexes to EF config (#3625)

* Add missing indexes to EF auth tables

* Add EF migrations
This commit is contained in:
Thomas Avery
2024-01-17 10:42:43 -06:00
committed by GitHub
parent 96f9fbb951
commit 880ceafe9f
12 changed files with 7425 additions and 9 deletions

View File

@@ -21,6 +21,10 @@ public class GrantEntityTypeConfiguration : IEntityTypeConfiguration<Grant>
.HasIndex(s => s.Key)
.IsUnique(true);
builder
.HasIndex(s => s.ExpirationDate)
.IsClustered(false);
builder.ToTable(nameof(Grant));
}
}

View File

@@ -0,0 +1,28 @@
using Bit.Infrastructure.EntityFramework.Auth.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Bit.Infrastructure.EntityFramework.Auth.Configurations;
public class SsoUserEntityTypeConfiguration : IEntityTypeConfiguration<SsoUser>
{
public void Configure(EntityTypeBuilder<SsoUser> builder)
{
builder
.HasIndex(su => su.OrganizationId)
.IsClustered(false);
NpgsqlIndexBuilderExtensions.IncludeProperties(
builder.HasIndex(su => new { su.OrganizationId, su.ExternalId })
.IsUnique()
.IsClustered(false),
su => su.UserId);
builder
.HasIndex(su => new { su.OrganizationId, su.UserId })
.IsUnique()
.IsClustered(false);
builder.ToTable(nameof(SsoUser));
}
}