Realm post

This commit is contained in:
2025-08-15 02:42:35 +08:00
parent 6211f546b1
commit cb420c2262
5 changed files with 2049 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddRealmPost : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "realm_id",
table: "posts",
type: "uuid",
nullable: true);
migrationBuilder.CreateIndex(
name: "ix_posts_realm_id",
table: "posts",
column: "realm_id");
migrationBuilder.AddForeignKey(
name: "fk_posts_realms_realm_id",
table: "posts",
column: "realm_id",
principalTable: "realms",
principalColumn: "id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_posts_realms_realm_id",
table: "posts");
migrationBuilder.DropIndex(
name: "ix_posts_realm_id",
table: "posts");
migrationBuilder.DropColumn(
name: "realm_id",
table: "posts");
}
}
}

View File

@@ -575,6 +575,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("publisher_id");
b.Property<Guid?>("RealmId")
.HasColumnType("uuid")
.HasColumnName("realm_id");
b.Property<Guid?>("RepliedPostId")
.HasColumnType("uuid")
.HasColumnName("replied_post_id");
@@ -629,6 +633,9 @@ namespace DysonNetwork.Sphere.Migrations
b.HasIndex("PublisherId")
.HasDatabaseName("ix_posts_publisher_id");
b.HasIndex("RealmId")
.HasDatabaseName("ix_posts_realm_id");
b.HasIndex("RepliedPostId")
.HasDatabaseName("ix_posts_replied_post_id");
@@ -1652,6 +1659,11 @@ namespace DysonNetwork.Sphere.Migrations
.IsRequired()
.HasConstraintName("fk_posts_publishers_publisher_id");
b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm")
.WithMany()
.HasForeignKey("RealmId")
.HasConstraintName("fk_posts_realms_realm_id");
b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost")
.WithMany()
.HasForeignKey("RepliedPostId")
@@ -1662,6 +1674,8 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Publisher");
b.Navigation("Realm");
b.Navigation("RepliedPost");
});