♻️ Refactor activitypub content storage

This commit is contained in:
2025-12-30 23:37:57 +08:00
parent 8dc01c8a85
commit 6aa6833163
26 changed files with 3339 additions and 919 deletions

View File

@@ -543,9 +543,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(2048)")
.HasColumnName("announced_content_uri");
b.Property<List<ContentAttachment>>("Attachments")
.HasColumnType("jsonb")
.HasColumnName("attachments");
// b.Property<List<ContentAttachment>>("Attachments")
// .HasColumnType("jsonb")
// .HasColumnName("attachments");
b.Property<int>("BoostCount")
.HasColumnType("integer")
@@ -571,9 +571,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("edited_at");
b.Property<List<ContentEmoji>>("Emojis")
.HasColumnType("jsonb")
.HasColumnName("emojis");
// b.Property<List<ContentEmoji>>("Emojis")
// .HasColumnType("jsonb")
// .HasColumnName("emojis");
b.Property<string>("InReplyTo")
.HasMaxLength(2048)
@@ -601,9 +601,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("local_post_id");
b.Property<List<ContentMention>>("Mentions")
.HasColumnType("jsonb")
.HasColumnName("mentions");
// b.Property<List<ContentMention>>("Mentions")
// .HasColumnType("jsonb")
// .HasColumnName("mentions");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
@@ -622,9 +622,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(4096)")
.HasColumnName("summary");
b.Property<List<ContentTag>>("Tags")
.HasColumnType("jsonb")
.HasColumnName("tags");
// b.Property<List<ContentTag>>("Tags")
// .HasColumnType("jsonb")
// .HasColumnName("tags");
b.Property<string>("Title")
.HasMaxLength(1024)

View File

@@ -102,10 +102,10 @@ namespace DysonNetwork.Sphere.Migrations
published_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
edited_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
is_sensitive = table.Column<bool>(type: "boolean", nullable: false),
attachments = table.Column<List<ContentAttachment>>(type: "jsonb", nullable: true),
mentions = table.Column<List<ContentMention>>(type: "jsonb", nullable: true),
tags = table.Column<List<ContentTag>>(type: "jsonb", nullable: true),
emojis = table.Column<List<ContentEmoji>>(type: "jsonb", nullable: true),
// attachments = table.Column<List<ContentAttachment>>(type: "jsonb", nullable: true),
// mentions = table.Column<List<ContentMention>>(type: "jsonb", nullable: true),
// tags = table.Column<List<ContentTag>>(type: "jsonb", nullable: true),
// emojis = table.Column<List<ContentEmoji>>(type: "jsonb", nullable: true),
metadata = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
actor_id = table.Column<Guid>(type: "uuid", nullable: false),
instance_id = table.Column<Guid>(type: "uuid", nullable: false),

View File

@@ -549,9 +549,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(2048)")
.HasColumnName("announced_content_uri");
b.Property<List<ContentAttachment>>("Attachments")
.HasColumnType("jsonb")
.HasColumnName("attachments");
// b.Property<List<ContentAttachment>>("Attachments")
// .HasColumnType("jsonb")
// .HasColumnName("attachments");
b.Property<int>("BoostCount")
.HasColumnType("integer")
@@ -577,9 +577,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("edited_at");
b.Property<List<ContentEmoji>>("Emojis")
.HasColumnType("jsonb")
.HasColumnName("emojis");
// b.Property<List<ContentEmoji>>("Emojis")
// .HasColumnType("jsonb")
// .HasColumnName("emojis");
b.Property<string>("InReplyTo")
.HasMaxLength(2048)
@@ -607,9 +607,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("local_post_id");
b.Property<List<ContentMention>>("Mentions")
.HasColumnType("jsonb")
.HasColumnName("mentions");
// b.Property<List<ContentMention>>("Mentions")
// .HasColumnType("jsonb")
// .HasColumnName("mentions");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
@@ -628,9 +628,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(4096)")
.HasColumnName("summary");
b.Property<List<ContentTag>>("Tags")
.HasColumnType("jsonb")
.HasColumnName("tags");
// b.Property<List<ContentTag>>("Tags")
// .HasColumnType("jsonb")
// .HasColumnName("tags");
b.Property<string>("Title")
.HasMaxLength(1024)

View File

@@ -549,9 +549,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(2048)")
.HasColumnName("announced_content_uri");
b.Property<List<ContentAttachment>>("Attachments")
.HasColumnType("jsonb")
.HasColumnName("attachments");
// b.Property<List<ContentAttachment>>("Attachments")
// .HasColumnType("jsonb")
// .HasColumnName("attachments");
b.Property<int>("BoostCount")
.HasColumnType("integer")
@@ -577,9 +577,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("edited_at");
b.Property<List<ContentEmoji>>("Emojis")
.HasColumnType("jsonb")
.HasColumnName("emojis");
// b.Property<List<ContentEmoji>>("Emojis")
// .HasColumnType("jsonb")
// .HasColumnName("emojis");
b.Property<string>("InReplyTo")
.HasMaxLength(2048)
@@ -607,9 +607,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("local_post_id");
b.Property<List<ContentMention>>("Mentions")
.HasColumnType("jsonb")
.HasColumnName("mentions");
// b.Property<List<ContentMention>>("Mentions")
// .HasColumnType("jsonb")
// .HasColumnName("mentions");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
@@ -628,9 +628,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(4096)")
.HasColumnName("summary");
b.Property<List<ContentTag>>("Tags")
.HasColumnType("jsonb")
.HasColumnName("tags");
// b.Property<List<ContentTag>>("Tags")
// .HasColumnType("jsonb")
// .HasColumnName("tags");
b.Property<string>("Title")
.HasMaxLength(1024)

View File

@@ -553,9 +553,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(2048)")
.HasColumnName("announced_content_uri");
b.Property<List<ContentAttachment>>("Attachments")
.HasColumnType("jsonb")
.HasColumnName("attachments");
// b.Property<List<ContentAttachment>>("Attachments")
// .HasColumnType("jsonb")
// .HasColumnName("attachments");
b.Property<int>("BoostCount")
.HasColumnType("integer")
@@ -581,9 +581,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("edited_at");
b.Property<List<ContentEmoji>>("Emojis")
.HasColumnType("jsonb")
.HasColumnName("emojis");
// b.Property<List<ContentEmoji>>("Emojis")
// .HasColumnType("jsonb")
// .HasColumnName("emojis");
b.Property<string>("InReplyTo")
.HasMaxLength(2048)
@@ -611,9 +611,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("local_post_id");
b.Property<List<ContentMention>>("Mentions")
.HasColumnType("jsonb")
.HasColumnName("mentions");
// b.Property<List<ContentMention>>("Mentions")
// .HasColumnType("jsonb")
// .HasColumnName("mentions");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
@@ -632,9 +632,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(4096)")
.HasColumnName("summary");
b.Property<List<ContentTag>>("Tags")
.HasColumnType("jsonb")
.HasColumnName("tags");
// b.Property<List<ContentTag>>("Tags")
// .HasColumnType("jsonb")
// .HasColumnName("tags");
b.Property<string>("Title")
.HasMaxLength(1024)

View File

@@ -553,9 +553,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(2048)")
.HasColumnName("announced_content_uri");
b.Property<List<ContentAttachment>>("Attachments")
.HasColumnType("jsonb")
.HasColumnName("attachments");
// b.Property<List<ContentAttachment>>("Attachments")
// .HasColumnType("jsonb")
// .HasColumnName("attachments");
b.Property<int>("BoostCount")
.HasColumnType("integer")
@@ -581,9 +581,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("edited_at");
b.Property<List<ContentEmoji>>("Emojis")
.HasColumnType("jsonb")
.HasColumnName("emojis");
// b.Property<List<ContentEmoji>>("Emojis")
// .HasColumnType("jsonb")
// .HasColumnName("emojis");
b.Property<string>("InReplyTo")
.HasMaxLength(2048)
@@ -611,9 +611,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("local_post_id");
b.Property<List<ContentMention>>("Mentions")
.HasColumnType("jsonb")
.HasColumnName("mentions");
// b.Property<List<ContentMention>>("Mentions")
// .HasColumnType("jsonb")
// .HasColumnName("mentions");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
@@ -632,9 +632,9 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(4096)")
.HasColumnName("summary");
b.Property<List<ContentTag>>("Tags")
.HasColumnType("jsonb")
.HasColumnName("tags");
// b.Property<List<ContentTag>>("Tags")
// .HasColumnType("jsonb")
// .HasColumnName("tags");
b.Property<string>("Title")
.HasMaxLength(1024)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,433 @@
using System;
using System.Collections.Generic;
using DysonNetwork.Shared.Models;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class MergeFediverseDataClass : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_posts_publishers_publisher_id",
table: "posts");
migrationBuilder.DropTable(
name: "fediverse_activities");
migrationBuilder.DropTable(
name: "fediverse_reactions");
migrationBuilder.DropTable(
name: "fediverse_contents");
migrationBuilder.RenameColumn(
name: "meta",
table: "posts",
newName: "metadata");
migrationBuilder.AlterColumn<Guid>(
name: "publisher_id",
table: "posts",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddColumn<Guid>(
name: "actor_id",
table: "posts",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "boost_count",
table: "posts",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "content_type",
table: "posts",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "fediverse_type",
table: "posts",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "fediverse_uri",
table: "posts",
type: "character varying(8192)",
maxLength: 8192,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "language",
table: "posts",
type: "character varying(2048)",
maxLength: 2048,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "like_count",
table: "posts",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<List<ContentMention>>(
name: "mentions",
table: "posts",
type: "jsonb",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "replies_count",
table: "posts",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<Guid>(
name: "account_id",
table: "post_reactions",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddColumn<Guid>(
name: "actor_id",
table: "post_reactions",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "fediverse_uri",
table: "post_reactions",
type: "character varying(2048)",
maxLength: 2048,
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "is_local",
table: "post_reactions",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.CreateIndex(
name: "ix_posts_actor_id",
table: "posts",
column: "actor_id");
migrationBuilder.CreateIndex(
name: "ix_post_reactions_actor_id",
table: "post_reactions",
column: "actor_id");
migrationBuilder.AddForeignKey(
name: "fk_post_reactions_fediverse_actors_actor_id",
table: "post_reactions",
column: "actor_id",
principalTable: "fediverse_actors",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_posts_fediverse_actors_actor_id",
table: "posts",
column: "actor_id",
principalTable: "fediverse_actors",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_posts_publishers_publisher_id",
table: "posts",
column: "publisher_id",
principalTable: "publishers",
principalColumn: "id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_post_reactions_fediverse_actors_actor_id",
table: "post_reactions");
migrationBuilder.DropForeignKey(
name: "fk_posts_fediverse_actors_actor_id",
table: "posts");
migrationBuilder.DropForeignKey(
name: "fk_posts_publishers_publisher_id",
table: "posts");
migrationBuilder.DropIndex(
name: "ix_posts_actor_id",
table: "posts");
migrationBuilder.DropIndex(
name: "ix_post_reactions_actor_id",
table: "post_reactions");
migrationBuilder.DropColumn(
name: "actor_id",
table: "posts");
migrationBuilder.DropColumn(
name: "boost_count",
table: "posts");
migrationBuilder.DropColumn(
name: "content_type",
table: "posts");
migrationBuilder.DropColumn(
name: "fediverse_type",
table: "posts");
migrationBuilder.DropColumn(
name: "fediverse_uri",
table: "posts");
migrationBuilder.DropColumn(
name: "language",
table: "posts");
migrationBuilder.DropColumn(
name: "like_count",
table: "posts");
migrationBuilder.DropColumn(
name: "mentions",
table: "posts");
migrationBuilder.DropColumn(
name: "replies_count",
table: "posts");
migrationBuilder.DropColumn(
name: "actor_id",
table: "post_reactions");
migrationBuilder.DropColumn(
name: "fediverse_uri",
table: "post_reactions");
migrationBuilder.DropColumn(
name: "is_local",
table: "post_reactions");
migrationBuilder.RenameColumn(
name: "metadata",
table: "posts",
newName: "meta");
migrationBuilder.AlterColumn<Guid>(
name: "publisher_id",
table: "posts",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "account_id",
table: "post_reactions",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.CreateTable(
name: "fediverse_contents",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
actor_id = table.Column<Guid>(type: "uuid", nullable: false),
instance_id = table.Column<Guid>(type: "uuid", nullable: false),
announced_content_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
boost_count = table.Column<int>(type: "integer", nullable: false),
content = table.Column<string>(type: "text", nullable: true),
content_html = table.Column<string>(type: "text", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
edited_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
in_reply_to = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
is_sensitive = table.Column<bool>(type: "boolean", nullable: false),
language = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
like_count = table.Column<int>(type: "integer", nullable: false),
local_post_id = table.Column<Guid>(type: "uuid", nullable: true),
metadata = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
published_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
reply_count = table.Column<int>(type: "integer", nullable: false),
summary = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
title = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
type = table.Column<int>(type: "integer", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_fediverse_contents", x => x.id);
table.ForeignKey(
name: "fk_fediverse_contents_fediverse_actors_actor_id",
column: x => x.actor_id,
principalTable: "fediverse_actors",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_fediverse_contents_fediverse_instances_instance_id",
column: x => x.instance_id,
principalTable: "fediverse_instances",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "fediverse_activities",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
actor_id = table.Column<Guid>(type: "uuid", nullable: false),
content_id = table.Column<Guid>(type: "uuid", nullable: true),
target_actor_id = table.Column<Guid>(type: "uuid", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
error_message = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
is_local = table.Column<bool>(type: "boolean", nullable: false),
local_account_id = table.Column<Guid>(type: "uuid", nullable: true),
local_post_id = table.Column<Guid>(type: "uuid", nullable: true),
object_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
published_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
raw_data = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
status = table.Column<int>(type: "integer", nullable: false),
target_uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
type = table.Column<int>(type: "integer", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_fediverse_activities", x => x.id);
table.ForeignKey(
name: "fk_fediverse_activities_fediverse_actors_actor_id",
column: x => x.actor_id,
principalTable: "fediverse_actors",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_fediverse_activities_fediverse_actors_target_actor_id",
column: x => x.target_actor_id,
principalTable: "fediverse_actors",
principalColumn: "id");
table.ForeignKey(
name: "fk_fediverse_activities_fediverse_contents_content_id",
column: x => x.content_id,
principalTable: "fediverse_contents",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "fediverse_reactions",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
actor_id = table.Column<Guid>(type: "uuid", nullable: false),
content_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
emoji = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
is_local = table.Column<bool>(type: "boolean", nullable: false),
local_account_id = table.Column<Guid>(type: "uuid", nullable: true),
local_reaction_id = table.Column<Guid>(type: "uuid", nullable: true),
type = table.Column<int>(type: "integer", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
uri = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_fediverse_reactions", x => x.id);
table.ForeignKey(
name: "fk_fediverse_reactions_fediverse_actors_actor_id",
column: x => x.actor_id,
principalTable: "fediverse_actors",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_fediverse_reactions_fediverse_contents_content_id",
column: x => x.content_id,
principalTable: "fediverse_contents",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_fediverse_activities_actor_id",
table: "fediverse_activities",
column: "actor_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_activities_content_id",
table: "fediverse_activities",
column: "content_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_activities_target_actor_id",
table: "fediverse_activities",
column: "target_actor_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_contents_actor_id",
table: "fediverse_contents",
column: "actor_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_contents_instance_id",
table: "fediverse_contents",
column: "instance_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_contents_uri",
table: "fediverse_contents",
column: "uri",
unique: true);
migrationBuilder.CreateIndex(
name: "ix_fediverse_reactions_actor_id",
table: "fediverse_reactions",
column: "actor_id");
migrationBuilder.CreateIndex(
name: "ix_fediverse_reactions_content_id",
table: "fediverse_reactions",
column: "content_id");
migrationBuilder.AddForeignKey(
name: "fk_posts_publishers_publisher_id",
table: "posts",
column: "publisher_id",
principalTable: "publishers",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -302,101 +302,6 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("chat_rooms", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActivity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("ActorId")
.HasColumnType("uuid")
.HasColumnName("actor_id");
b.Property<Guid?>("ContentId")
.HasColumnType("uuid")
.HasColumnName("content_id");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<Instant?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property<string>("ErrorMessage")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("error_message");
b.Property<bool>("IsLocal")
.HasColumnType("boolean")
.HasColumnName("is_local");
b.Property<Guid?>("LocalAccountId")
.HasColumnType("uuid")
.HasColumnName("local_account_id");
b.Property<Guid?>("LocalPostId")
.HasColumnType("uuid")
.HasColumnName("local_post_id");
b.Property<string>("ObjectUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("object_uri");
b.Property<Instant?>("PublishedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("published_at");
b.Property<Dictionary<string, object>>("RawData")
.HasColumnType("jsonb")
.HasColumnName("raw_data");
b.Property<int>("Status")
.HasColumnType("integer")
.HasColumnName("status");
b.Property<Guid?>("TargetActorId")
.HasColumnType("uuid")
.HasColumnName("target_actor_id");
b.Property<string>("TargetUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("target_uri");
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<string>("Uri")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("uri");
b.HasKey("Id")
.HasName("pk_fediverse_activities");
b.HasIndex("ActorId")
.HasDatabaseName("ix_fediverse_activities_actor_id");
b.HasIndex("ContentId")
.HasDatabaseName("ix_fediverse_activities_content_id");
b.HasIndex("TargetActorId")
.HasDatabaseName("ix_fediverse_activities_target_actor_id");
b.ToTable("fediverse_activities", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActor", b =>
{
b.Property<Guid>("Id")
@@ -534,140 +439,6 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("fediverse_actors", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseContent", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("ActorId")
.HasColumnType("uuid")
.HasColumnName("actor_id");
b.Property<string>("AnnouncedContentUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("announced_content_uri");
b.Property<List<ContentAttachment>>("Attachments")
.HasColumnType("jsonb")
.HasColumnName("attachments");
b.Property<int>("BoostCount")
.HasColumnType("integer")
.HasColumnName("boost_count");
b.Property<string>("Content")
.HasColumnType("text")
.HasColumnName("content");
b.Property<string>("ContentHtml")
.HasColumnType("text")
.HasColumnName("content_html");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<Instant?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property<Instant?>("EditedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("edited_at");
b.Property<List<ContentEmoji>>("Emojis")
.HasColumnType("jsonb")
.HasColumnName("emojis");
b.Property<string>("InReplyTo")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("in_reply_to");
b.Property<Guid>("InstanceId")
.HasColumnType("uuid")
.HasColumnName("instance_id");
b.Property<bool>("IsSensitive")
.HasColumnType("boolean")
.HasColumnName("is_sensitive");
b.Property<string>("Language")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("language");
b.Property<int>("LikeCount")
.HasColumnType("integer")
.HasColumnName("like_count");
b.Property<Guid?>("LocalPostId")
.HasColumnType("uuid")
.HasColumnName("local_post_id");
b.Property<List<ContentMention>>("Mentions")
.HasColumnType("jsonb")
.HasColumnName("mentions");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
.HasColumnName("metadata");
b.Property<Instant?>("PublishedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("published_at");
b.Property<int>("ReplyCount")
.HasColumnType("integer")
.HasColumnName("reply_count");
b.Property<string>("Summary")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("summary");
b.Property<List<ContentTag>>("Tags")
.HasColumnType("jsonb")
.HasColumnName("tags");
b.Property<string>("Title")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("title");
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<string>("Uri")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("uri");
b.HasKey("Id")
.HasName("pk_fediverse_contents");
b.HasIndex("ActorId")
.HasDatabaseName("ix_fediverse_contents_actor_id");
b.HasIndex("InstanceId")
.HasDatabaseName("ix_fediverse_contents_instance_id");
b.HasIndex("Uri")
.IsUnique()
.HasDatabaseName("ix_fediverse_contents_uri");
b.ToTable("fediverse_contents", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseInstance", b =>
{
b.Property<Guid>("Id")
@@ -776,72 +547,6 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("fediverse_instances", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseReaction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("ActorId")
.HasColumnType("uuid")
.HasColumnName("actor_id");
b.Property<Guid>("ContentId")
.HasColumnType("uuid")
.HasColumnName("content_id");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<Instant?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property<string>("Emoji")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("emoji");
b.Property<bool>("IsLocal")
.HasColumnType("boolean")
.HasColumnName("is_local");
b.Property<Guid?>("LocalAccountId")
.HasColumnType("uuid")
.HasColumnName("local_account_id");
b.Property<Guid?>("LocalReactionId")
.HasColumnType("uuid")
.HasColumnName("local_reaction_id");
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<string>("Uri")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("uri");
b.HasKey("Id")
.HasName("pk_fediverse_reactions");
b.HasIndex("ActorId")
.HasDatabaseName("ix_fediverse_reactions_actor_id");
b.HasIndex("ContentId")
.HasDatabaseName("ix_fediverse_reactions_content_id");
b.ToTable("fediverse_reactions", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseRelationship", b =>
{
b.Property<Guid>("Id")
@@ -1071,6 +776,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid?>("ActorId")
.HasColumnType("uuid")
.HasColumnName("actor_id");
b.Property<List<SnCloudFileReferenceObject>>("Attachments")
.IsRequired()
.HasColumnType("jsonb")
@@ -1080,10 +789,18 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("numeric")
.HasColumnName("awarded_score");
b.Property<int>("BoostCount")
.HasColumnType("integer")
.HasColumnName("boost_count");
b.Property<string>("Content")
.HasColumnType("text")
.HasColumnName("content");
b.Property<int>("ContentType")
.HasColumnType("integer")
.HasColumnName("content_type");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
@@ -1109,6 +826,15 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("jsonb")
.HasColumnName("embed_view");
b.Property<int?>("FediverseType")
.HasColumnType("integer")
.HasColumnName("fediverse_type");
b.Property<string>("FediverseUri")
.HasMaxLength(8192)
.HasColumnType("character varying(8192)")
.HasColumnName("fediverse_uri");
b.Property<bool>("ForwardedGone")
.HasColumnType("boolean")
.HasColumnName("forwarded_gone");
@@ -1117,9 +843,22 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("forwarded_post_id");
b.Property<Dictionary<string, object>>("Meta")
b.Property<string>("Language")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("language");
b.Property<int>("LikeCount")
.HasColumnType("integer")
.HasColumnName("like_count");
b.Property<List<ContentMention>>("Mentions")
.HasColumnType("jsonb")
.HasColumnName("meta");
.HasColumnName("mentions");
b.Property<Dictionary<string, object>>("Metadata")
.HasColumnType("jsonb")
.HasColumnName("metadata");
b.Property<int?>("PinMode")
.HasColumnType("integer")
@@ -1129,7 +868,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("published_at");
b.Property<Guid>("PublisherId")
b.Property<Guid?>("PublisherId")
.HasColumnType("uuid")
.HasColumnName("publisher_id");
@@ -1145,6 +884,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("replied_post_id");
b.Property<int>("RepliesCount")
.HasColumnType("integer")
.HasColumnName("replies_count");
b.PrimitiveCollection<string>("SensitiveMarks")
.HasColumnType("jsonb")
.HasColumnName("sensitive_marks");
@@ -1186,6 +929,9 @@ namespace DysonNetwork.Sphere.Migrations
b.HasKey("Id")
.HasName("pk_posts");
b.HasIndex("ActorId")
.HasDatabaseName("ix_posts_actor_id");
b.HasIndex("ForwardedPostId")
.HasDatabaseName("ix_posts_forwarded_post_id");
@@ -1421,10 +1167,14 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("AccountId")
b.Property<Guid?>("AccountId")
.HasColumnType("uuid")
.HasColumnName("account_id");
b.Property<Guid?>("ActorId")
.HasColumnType("uuid")
.HasColumnName("actor_id");
b.Property<int>("Attitude")
.HasColumnType("integer")
.HasColumnName("attitude");
@@ -1437,6 +1187,15 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property<string>("FediverseUri")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("fediverse_uri");
b.Property<bool>("IsLocal")
.HasColumnType("boolean")
.HasColumnName("is_local");
b.Property<Guid>("PostId")
.HasColumnType("uuid")
.HasColumnName("post_id");
@@ -1454,6 +1213,9 @@ namespace DysonNetwork.Sphere.Migrations
b.HasKey("Id")
.HasName("pk_post_reactions");
b.HasIndex("ActorId")
.HasDatabaseName("ix_post_reactions_actor_id");
b.HasIndex("PostId")
.HasDatabaseName("ix_post_reactions_post_id");
@@ -2198,33 +1960,6 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Sender");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActivity", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
.WithMany("Activities")
.HasForeignKey("ActorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_activities_fediverse_actors_actor_id");
b.HasOne("DysonNetwork.Shared.Models.SnFediverseContent", "Content")
.WithMany("Activities")
.HasForeignKey("ContentId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_fediverse_activities_fediverse_contents_content_id");
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "TargetActor")
.WithMany()
.HasForeignKey("TargetActorId")
.HasConstraintName("fk_fediverse_activities_fediverse_actors_target_actor_id");
b.Navigation("Actor");
b.Navigation("Content");
b.Navigation("TargetActor");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActor", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseInstance", "Instance")
@@ -2237,48 +1972,6 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Instance");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseContent", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
.WithMany("Contents")
.HasForeignKey("ActorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_contents_fediverse_actors_actor_id");
b.HasOne("DysonNetwork.Shared.Models.SnFediverseInstance", "Instance")
.WithMany("Contents")
.HasForeignKey("InstanceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_contents_fediverse_instances_instance_id");
b.Navigation("Actor");
b.Navigation("Instance");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseReaction", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
.WithMany()
.HasForeignKey("ActorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_reactions_fediverse_actors_actor_id");
b.HasOne("DysonNetwork.Shared.Models.SnFediverseContent", "Content")
.WithMany("Reactions")
.HasForeignKey("ContentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_fediverse_reactions_fediverse_contents_content_id");
b.Navigation("Actor");
b.Navigation("Content");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseRelationship", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
@@ -2338,6 +2031,11 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPost", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
.WithMany()
.HasForeignKey("ActorId")
.HasConstraintName("fk_posts_fediverse_actors_actor_id");
b.HasOne("DysonNetwork.Shared.Models.SnPost", "ForwardedPost")
.WithMany()
.HasForeignKey("ForwardedPostId")
@@ -2347,8 +2045,6 @@ namespace DysonNetwork.Sphere.Migrations
b.HasOne("DysonNetwork.Shared.Models.SnPublisher", "Publisher")
.WithMany("Posts")
.HasForeignKey("PublisherId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_posts_publishers_publisher_id");
b.HasOne("DysonNetwork.Shared.Models.SnPost", "RepliedPost")
@@ -2357,6 +2053,8 @@ namespace DysonNetwork.Sphere.Migrations
.OnDelete(DeleteBehavior.Restrict)
.HasConstraintName("fk_posts_posts_replied_post_id");
b.Navigation("Actor");
b.Navigation("ForwardedPost");
b.Navigation("Publisher");
@@ -2419,6 +2117,11 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPostReaction", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnFediverseActor", "Actor")
.WithMany()
.HasForeignKey("ActorId")
.HasConstraintName("fk_post_reactions_fediverse_actors_actor_id");
b.HasOne("DysonNetwork.Shared.Models.SnPost", "Post")
.WithMany("Reactions")
.HasForeignKey("PostId")
@@ -2426,6 +2129,8 @@ namespace DysonNetwork.Sphere.Migrations
.IsRequired()
.HasConstraintName("fk_post_reactions_posts_post_id");
b.Navigation("Actor");
b.Navigation("Post");
});
@@ -2621,27 +2326,14 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseActor", b =>
{
b.Navigation("Activities");
b.Navigation("Contents");
b.Navigation("FollowerRelationships");
b.Navigation("FollowingRelationships");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseContent", b =>
{
b.Navigation("Activities");
b.Navigation("Reactions");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnFediverseInstance", b =>
{
b.Navigation("Actors");
b.Navigation("Contents");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPoll", b =>