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:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user