[backend/database] Remove redundant index on the marker table
This index is identical to the composite primary key, and therefore redundant.
This commit is contained in:
parent
79c3a9c891
commit
e04665f9d7
3 changed files with 31 additions and 4 deletions
|
@ -1638,9 +1638,6 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.HasIndex("UserId", "Type")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("marker");
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Iceshrimp.Backend.Core.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20240419181840_RemoveRedundantMarkerIndex")]
|
||||
public partial class RemoveRedundantMarkerIndex : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_marker_userId_type",
|
||||
table: "marker");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_marker_userId_type",
|
||||
table: "marker",
|
||||
columns: new[] { "userId", "type" },
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@ namespace Iceshrimp.Backend.Core.Database.Tables;
|
|||
|
||||
[Table("marker")]
|
||||
[Index(nameof(UserId))]
|
||||
[Index(nameof(UserId), nameof(Type), IsUnique = true)]
|
||||
[PrimaryKey(nameof(UserId), nameof(Type))]
|
||||
public class Marker
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue