Rename GIN indicies

This commit is contained in:
Laura Hausmann 2024-01-07 20:05:55 +01:00
parent de13c8151b
commit 0e14967f5a
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
4 changed files with 6034 additions and 16 deletions

View file

@ -516,13 +516,10 @@ public class DatabaseContext : DbContext {
});
modelBuilder.Entity<Note>(entity => {
entity.HasIndex(e => e.Mentions, "IDX_NOTE_MENTIONS").HasMethod("gin");
entity.HasIndex(e => e.Tags, "IDX_NOTE_TAGS").HasMethod("gin");
entity.HasIndex(e => e.VisibleUserIds, "IDX_NOTE_VISIBLE_USER_IDS").HasMethod("gin");
entity.HasIndex(e => e.Text, "note_text_fts_idx")
entity.HasIndex(e => e.Mentions, "GIN_note_mentions").HasMethod("gin");
entity.HasIndex(e => e.Tags, "GIN_note_tags").HasMethod("gin");
entity.HasIndex(e => e.VisibleUserIds, "GIN_note_visibleUserIds").HasMethod("gin");
entity.HasIndex(e => e.Text, "GIN_TRGM_note_text")
.HasMethod("gin")
.HasOperators("gin_trgm_ops");

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,58 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Iceshrimp.Backend.Core.Database.Migrations
{
/// <inheritdoc />
public partial class RenameGinIndicies : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameIndex(
name: "note_text_fts_idx",
table: "note",
newName: "GIN_TRGM_note_text");
migrationBuilder.RenameIndex(
name: "IDX_NOTE_VISIBLE_USER_IDS",
table: "note",
newName: "GIN_note_visibleUserIds");
migrationBuilder.RenameIndex(
name: "IDX_NOTE_TAGS",
table: "note",
newName: "GIN_note_tags");
migrationBuilder.RenameIndex(
name: "IDX_NOTE_MENTIONS",
table: "note",
newName: "GIN_note_mentions");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameIndex(
name: "GIN_note_visibleUserIds",
table: "note",
newName: "IDX_NOTE_VISIBLE_USER_IDS");
migrationBuilder.RenameIndex(
name: "GIN_note_tags",
table: "note",
newName: "IDX_NOTE_TAGS");
migrationBuilder.RenameIndex(
name: "GIN_note_mentions",
table: "note",
newName: "IDX_NOTE_MENTIONS");
migrationBuilder.RenameIndex(
name: "GIN_TRGM_note_text",
table: "note",
newName: "note_text_fts_idx");
}
}
}

View file

@ -2556,22 +2556,22 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
b.HasIndex("UserId", "Id");
b.HasIndex(new[] { "Mentions" }, "IDX_NOTE_MENTIONS");
b.HasIndex(new[] { "Text" }, "GIN_TRGM_note_text");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Mentions" }, "IDX_NOTE_MENTIONS"), "gin");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Text" }, "GIN_TRGM_note_text"), "gin");
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Text" }, "GIN_TRGM_note_text"), new[] { "gin_trgm_ops" });
b.HasIndex(new[] { "Tags" }, "IDX_NOTE_TAGS");
b.HasIndex(new[] { "Mentions" }, "GIN_note_mentions");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Tags" }, "IDX_NOTE_TAGS"), "gin");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Mentions" }, "GIN_note_mentions"), "gin");
b.HasIndex(new[] { "VisibleUserIds" }, "IDX_NOTE_VISIBLE_USER_IDS");
b.HasIndex(new[] { "Tags" }, "GIN_note_tags");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "VisibleUserIds" }, "IDX_NOTE_VISIBLE_USER_IDS"), "gin");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Tags" }, "GIN_note_tags"), "gin");
b.HasIndex(new[] { "Text" }, "note_text_fts_idx");
b.HasIndex(new[] { "VisibleUserIds" }, "GIN_note_visibleUserIds");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "Text" }, "note_text_fts_idx"), "gin");
NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex(new[] { "Text" }, "note_text_fts_idx"), new[] { "gin_trgm_ops" });
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex(new[] { "VisibleUserIds" }, "GIN_note_visibleUserIds"), "gin");
b.ToTable("note");
});