[backend/database] Add renoteUri and replyUri properties to the note table
This commit is contained in:
parent
ec99163711
commit
d54cb5c391
4 changed files with 99 additions and 0 deletions
|
@ -655,6 +655,10 @@ public class DatabaseContext(DbContextOptions<DatabaseContext> options)
|
|||
entity.Property(e => e.UserHost).HasComment("[Denormalized]");
|
||||
entity.Property(e => e.UserId).HasComment("The ID of author.");
|
||||
entity.Property(e => e.VisibleUserIds).HasDefaultValueSql("'{}'::character varying[]");
|
||||
entity.Property(e => e.ReplyUri)
|
||||
.HasComment("The URI of the reply target, if it couldn't be resolved at time of ingestion.");
|
||||
entity.Property(e => e.RenoteUri)
|
||||
.HasComment("The URI of the renote target, if it couldn't be resolved at time of ingestion.");
|
||||
|
||||
entity.HasOne(d => d.Channel)
|
||||
.WithMany(p => p.Notes)
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Iceshrimp.Backend.Core.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20240429190728_AddNoteRenoteReplyUriColumns")]
|
||||
public partial class AddNoteRenoteReplyUriColumns : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "renoteUri",
|
||||
table: "note",
|
||||
type: "character varying(512)",
|
||||
maxLength: 512,
|
||||
nullable: true,
|
||||
comment: "The URI of the renote target, if it couldn't be resolved at time of ingestion.");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "replyUri",
|
||||
table: "note",
|
||||
type: "character varying(512)",
|
||||
maxLength: 512,
|
||||
nullable: true,
|
||||
comment: "The URI of the reply target, if it couldn't be resolved at time of ingestion.");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_note_renoteUri",
|
||||
table: "note",
|
||||
column: "renoteUri");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_note_replyUri",
|
||||
table: "note",
|
||||
column: "replyUri");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_note_renoteUri",
|
||||
table: "note");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_note_replyUri",
|
||||
table: "note");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "renoteUri",
|
||||
table: "note");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "replyUri",
|
||||
table: "note");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2417,6 +2417,12 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
|||
.HasColumnName("renoteId")
|
||||
.HasComment("The ID of renote target.");
|
||||
|
||||
b.Property<string>("RenoteUri")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
.HasColumnName("renoteUri")
|
||||
.HasComment("The URI of the renote target, if it couldn't be resolved at time of ingestion.");
|
||||
|
||||
b.Property<string>("RenoteUserHost")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
|
@ -2441,6 +2447,12 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
|||
.HasColumnName("replyId")
|
||||
.HasComment("The ID of reply target.");
|
||||
|
||||
b.Property<string>("ReplyUri")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
.HasColumnName("replyUri")
|
||||
.HasComment("The URI of the reply target, if it couldn't be resolved at time of ingestion.");
|
||||
|
||||
b.Property<string>("ReplyUserHost")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
|
@ -2530,8 +2542,12 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
|||
|
||||
b.HasIndex("RenoteId");
|
||||
|
||||
b.HasIndex("RenoteUri");
|
||||
|
||||
b.HasIndex("ReplyId");
|
||||
|
||||
b.HasIndex("ReplyUri");
|
||||
|
||||
b.HasIndex("Tags");
|
||||
|
||||
b.HasIndex("ThreadId");
|
||||
|
|
|
@ -29,6 +29,8 @@ namespace Iceshrimp.Backend.Core.Database.Tables;
|
|||
[Index(nameof(Url))]
|
||||
[Index(nameof(UserId), nameof(Id))]
|
||||
[Index(nameof(Visibility))]
|
||||
[Index(nameof(ReplyUri))]
|
||||
[Index(nameof(RenoteUri))]
|
||||
public class Note : IEntity
|
||||
{
|
||||
[PgName("note_visibility_enum")]
|
||||
|
@ -59,6 +61,20 @@ public class Note : IEntity
|
|||
[Column("renoteId")]
|
||||
[StringLength(32)]
|
||||
public string? RenoteId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The URI of the reply target, if it couldn't be resolved at time of ingestion.
|
||||
/// </summary>
|
||||
[Column("replyUri")]
|
||||
[StringLength(512)]
|
||||
public string? ReplyUri { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The URI of the renote target, if it couldn't be resolved at time of ingestion.
|
||||
/// </summary>
|
||||
[Column("renoteUri")]
|
||||
[StringLength(512)]
|
||||
public string? RenoteUri { get; set; }
|
||||
|
||||
[Column("text")] public string? Text { get; set; }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue