mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -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:
@ -0,0 +1,47 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.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)
|
||||
.Annotation("Npgsql:IndexInclude", new[] { "UserId" });
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user