mirror of
https://github.com/bitwarden/server.git
synced 2025-04-04 20:50:21 -05:00
[BEEEP] [SM-1060] Add missing tools table indexes to EF config (#3626)
* Add missing indexes * Add EF migrations
This commit is contained in:
parent
8daa754ecb
commit
a480bd16e4
@ -91,7 +91,6 @@ public class DatabaseContext : DbContext
|
||||
var eProvider = builder.Entity<Provider>();
|
||||
var eProviderUser = builder.Entity<ProviderUser>();
|
||||
var eProviderOrganization = builder.Entity<ProviderOrganization>();
|
||||
var eSend = builder.Entity<Send>();
|
||||
var eSsoConfig = builder.Entity<SsoConfig>();
|
||||
var eSsoUser = builder.Entity<SsoUser>();
|
||||
var eTaxRate = builder.Entity<TaxRate>();
|
||||
@ -122,7 +121,6 @@ public class DatabaseContext : DbContext
|
||||
eProvider.Property(c => c.Id).ValueGeneratedNever();
|
||||
eProviderUser.Property(c => c.Id).ValueGeneratedNever();
|
||||
eProviderOrganization.Property(c => c.Id).ValueGeneratedNever();
|
||||
eSend.Property(c => c.Id).ValueGeneratedNever();
|
||||
eTransaction.Property(c => c.Id).ValueGeneratedNever();
|
||||
eUser.Property(c => c.Id).ValueGeneratedNever();
|
||||
eOrganizationApiKey.Property(c => c.Id).ValueGeneratedNever();
|
||||
@ -169,7 +167,6 @@ public class DatabaseContext : DbContext
|
||||
eProvider.ToTable(nameof(Provider));
|
||||
eProviderUser.ToTable(nameof(ProviderUser));
|
||||
eProviderOrganization.ToTable(nameof(ProviderOrganization));
|
||||
eSend.ToTable(nameof(Send));
|
||||
eSsoConfig.ToTable(nameof(SsoConfig));
|
||||
eSsoUser.ToTable(nameof(SsoUser));
|
||||
eTaxRate.ToTable(nameof(TaxRate));
|
||||
|
@ -0,0 +1,29 @@
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Tools.Configurations;
|
||||
|
||||
public class SendEntityTypeConfiguration : IEntityTypeConfiguration<Send>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Send> builder)
|
||||
{
|
||||
builder
|
||||
.Property(s => s.Id)
|
||||
.ValueGeneratedNever();
|
||||
|
||||
builder
|
||||
.HasIndex(s => s.UserId)
|
||||
.IsClustered(false);
|
||||
|
||||
builder
|
||||
.HasIndex(s => new { s.UserId, s.OrganizationId })
|
||||
.IsClustered(false);
|
||||
|
||||
builder
|
||||
.HasIndex(s => s.DeletionDate)
|
||||
.IsClustered(false);
|
||||
|
||||
builder.ToTable(nameof(Send));
|
||||
}
|
||||
}
|
2341
util/MySqlMigrations/Migrations/20231229202309_AddToolsTableIndexes.Designer.cs
generated
Normal file
2341
util/MySqlMigrations/Migrations/20231229202309_AddToolsTableIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddToolsTableIndexes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Send_DeletionDate",
|
||||
table: "Send",
|
||||
column: "DeletionDate");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Send_UserId_OrganizationId",
|
||||
table: "Send",
|
||||
columns: new[] { "UserId", "OrganizationId" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Send_DeletionDate",
|
||||
table: "Send");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Send_UserId_OrganizationId",
|
||||
table: "Send");
|
||||
}
|
||||
}
|
@ -1155,9 +1155,16 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DeletionDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Send", (string)null);
|
||||
});
|
||||
|
2354
util/PostgresMigrations/Migrations/20231229202259_AddToolsTableIndexes.Designer.cs
generated
Normal file
2354
util/PostgresMigrations/Migrations/20231229202259_AddToolsTableIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddToolsTableIndexes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Send_DeletionDate",
|
||||
table: "Send",
|
||||
column: "DeletionDate");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Send_UserId_OrganizationId",
|
||||
table: "Send",
|
||||
columns: new[] { "UserId", "OrganizationId" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Send_DeletionDate",
|
||||
table: "Send");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Send_UserId_OrganizationId",
|
||||
table: "Send");
|
||||
}
|
||||
}
|
@ -1167,9 +1167,16 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DeletionDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Send", (string)null);
|
||||
});
|
||||
|
2339
util/SqliteMigrations/Migrations/20231229202304_AddToolsTableIndexes.Designer.cs
generated
Normal file
2339
util/SqliteMigrations/Migrations/20231229202304_AddToolsTableIndexes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.SqliteMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddToolsTableIndexes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Send_DeletionDate",
|
||||
table: "Send",
|
||||
column: "DeletionDate");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Send_UserId_OrganizationId",
|
||||
table: "Send",
|
||||
columns: new[] { "UserId", "OrganizationId" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Send_DeletionDate",
|
||||
table: "Send");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Send_UserId_OrganizationId",
|
||||
table: "Send");
|
||||
}
|
||||
}
|
@ -1153,9 +1153,16 @@ namespace Bit.SqliteMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DeletionDate")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("UserId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.HasIndex("UserId", "OrganizationId")
|
||||
.HasAnnotation("SqlServer:Clustered", false);
|
||||
|
||||
b.ToTable("Send", (string)null);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user