mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[BEEEP][SM-1062] Add missing table indexes to EF config (#3628)
* Add missing EF indexes * Add EF migrations * move configs * regenerate migrations
This commit is contained in:
2380
util/MySqlMigrations/Migrations/20240109215348_AddTableIndexes.Designer.cs
generated
Normal file
2380
util/MySqlMigrations/Migrations/20240109215348_AddTableIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,110 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddTableIndexes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_User_Email",
|
||||
table: "User",
|
||||
column: "Email",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_User_Premium_PremiumExpirationDate_RenewalReminderDate",
|
||||
table: "User",
|
||||
columns: new[] { "Premium", "PremiumExpirationDate", "RenewalReminderDate" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Transaction_UserId_OrganizationId_CreationDate",
|
||||
table: "Transaction",
|
||||
columns: new[] { "UserId", "OrganizationId", "CreationDate" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Policy_OrganizationId_Type",
|
||||
table: "Policy",
|
||||
columns: new[] { "OrganizationId", "Type" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status",
|
||||
table: "OrganizationUser",
|
||||
columns: new[] { "UserId", "OrganizationId", "Status" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrganizationSponsorship_SponsoringOrganizationUserId",
|
||||
table: "OrganizationSponsorship",
|
||||
column: "SponsoringOrganizationUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Organization_Id_Enabled",
|
||||
table: "Organization",
|
||||
columns: new[] { "Id", "Enabled" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Event_Date_OrganizationId_ActingUserId_CipherId",
|
||||
table: "Event",
|
||||
columns: new[] { "Date", "OrganizationId", "ActingUserId", "CipherId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Device_Identifier",
|
||||
table: "Device",
|
||||
column: "Identifier");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Device_UserId_Identifier",
|
||||
table: "Device",
|
||||
columns: new[] { "UserId", "Identifier" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_User_Email",
|
||||
table: "User");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_User_Premium_PremiumExpirationDate_RenewalReminderDate",
|
||||
table: "User");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Transaction_UserId_OrganizationId_CreationDate",
|
||||
table: "Transaction");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Policy_OrganizationId_Type",
|
||||
table: "Policy");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_OrganizationUser_UserId_OrganizationId_Status",
|
||||
table: "OrganizationUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_OrganizationSponsorship_SponsoringOrganizationUserId",
|
||||
table: "OrganizationSponsorship");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Organization_Id_Enabled",
|
||||
table: "Organization");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Event_Date_OrganizationId_ActingUserId_CipherId",
|
||||
table: "Event");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Device_Identifier",
|
||||
table: "Device");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Device_UserId_Identifier",
|
||||
table: "Device");
|
||||
}
|
||||
}
|
@ -200,6 +200,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id", "Enabled")
|
||||
.HasAnnotation("Npgsql:IndexInclude", new[] { "UseTotp" });
|
||||
|
||||
b.ToTable("Organization", (string)null);
|
||||
});
|
||||
|
||||
@ -228,7 +231,12 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
b.HasIndex("OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("OrganizationId", "Type")
|
||||
.IsUnique()
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Policy", (string)null);
|
||||
});
|
||||
@ -774,7 +782,15 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("Identifier")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "Identifier")
|
||||
.IsUnique()
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Device", (string)null);
|
||||
});
|
||||
@ -847,6 +863,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Date", "OrganizationId", "ActingUserId", "CipherId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Event", (string)null);
|
||||
});
|
||||
|
||||
@ -1047,6 +1066,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasIndex("SponsoringOrganizationId");
|
||||
|
||||
b.HasIndex("SponsoringOrganizationUserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("OrganizationSponsorship", (string)null);
|
||||
});
|
||||
|
||||
@ -1098,9 +1120,15 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
b.HasIndex("OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "OrganizationId", "Status")
|
||||
.HasAnnotation("Npgsql:IndexInclude", new[] { "AccessAll" })
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("OrganizationUser", (string)null);
|
||||
});
|
||||
@ -1242,7 +1270,11 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "OrganizationId", "CreationDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Transaction", (string)null);
|
||||
});
|
||||
@ -1392,6 +1424,13 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique()
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("Premium", "PremiumExpirationDate", "RenewalReminderDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("User", (string)null);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user