mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05: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:
2398
util/MySqlMigrations/Migrations/20240112180622_AddAuthTableIndexes.Designer.cs
generated
Normal file
2398
util/MySqlMigrations/Migrations/20240112180622_AddAuthTableIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,46 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddAuthTableIndexes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SsoUser_OrganizationId_ExternalId",
|
||||
table: "SsoUser",
|
||||
columns: new[] { "OrganizationId", "ExternalId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SsoUser_OrganizationId_UserId",
|
||||
table: "SsoUser",
|
||||
columns: new[] { "OrganizationId", "UserId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Grant_ExpirationDate",
|
||||
table: "Grant",
|
||||
column: "ExpirationDate");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SsoUser_OrganizationId_ExternalId",
|
||||
table: "SsoUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SsoUser_OrganizationId_UserId",
|
||||
table: "SsoUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Grant_ExpirationDate",
|
||||
table: "Grant");
|
||||
}
|
||||
}
|
@ -3,8 +3,8 @@ using System;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
@ -490,7 +490,7 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ClientId")
|
||||
.IsRequired()
|
||||
@ -535,6 +535,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.HasKey("Id")
|
||||
.HasAnnotation("SqlServer:Clustered", true);
|
||||
|
||||
b.HasIndex("ExpirationDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
@ -590,10 +593,20 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
b.HasIndex("OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.HasIndex("OrganizationId", "ExternalId")
|
||||
.IsUnique()
|
||||
.HasAnnotation("Npgsql:IndexInclude", new[] { "UserId" })
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("OrganizationId", "UserId")
|
||||
.IsUnique()
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("SsoUser", (string)null);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user