✨ Posting
This commit is contained in:
@ -14,7 +14,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace DysonNetwork.Sphere.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDatabase))]
|
||||
[Migration("20250419062728_AddPost")]
|
||||
[Migration("20250419115230_AddPost")]
|
||||
partial class AddPost
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -73,6 +73,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_accounts");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_accounts_name");
|
||||
|
||||
b.ToTable("accounts", (string)null);
|
||||
});
|
||||
|
||||
@ -419,10 +423,27 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("downvotes");
|
||||
|
||||
b.Property<Instant?>("EditedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("edited_at");
|
||||
|
||||
b.Property<long?>("ForwardedPostId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("forwarded_post_id");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("language");
|
||||
|
||||
b.Property<Dictionary<string, object>>("Meta")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("meta");
|
||||
|
||||
b.Property<Instant?>("PublishedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("published_at");
|
||||
|
||||
b.Property<long>("PublisherId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("publisher_id");
|
||||
@ -431,6 +452,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("replied_post_id");
|
||||
|
||||
b.Property<long?>("ThreadedPostId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("threaded_post_id");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(1024)
|
||||
.HasColumnType("character varying(1024)")
|
||||
@ -456,6 +481,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("views_unique");
|
||||
|
||||
b.Property<int>("Visibility")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("visibility");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_posts");
|
||||
|
||||
@ -468,9 +497,101 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.HasIndex("RepliedPostId")
|
||||
.HasDatabaseName("ix_posts_replied_post_id");
|
||||
|
||||
b.HasIndex("ThreadedPostId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_posts_threaded_post_id");
|
||||
|
||||
b.ToTable("posts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("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>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_post_categories");
|
||||
|
||||
b.ToTable("post_categories", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("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>("Description")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<long>("PublisherId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("publisher_id");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_post_collections");
|
||||
|
||||
b.HasIndex("PublisherId")
|
||||
.HasDatabaseName("ix_post_collections_publisher_id");
|
||||
|
||||
b.ToTable("post_collections", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@ -522,6 +643,44 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.ToTable("post_reactions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("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>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_post_tags");
|
||||
|
||||
b.ToTable("post_tags", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@ -585,6 +744,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.HasIndex("BackgroundId")
|
||||
.HasDatabaseName("ix_publishers_background_id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_publishers_name");
|
||||
|
||||
b.HasIndex("PictureId")
|
||||
.HasDatabaseName("ix_publishers_picture_id");
|
||||
|
||||
@ -714,6 +877,63 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.ToTable("files", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostCategory", b =>
|
||||
{
|
||||
b.Property<long>("CategoriesId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("categories_id");
|
||||
|
||||
b.Property<long>("PostsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("posts_id");
|
||||
|
||||
b.HasKey("CategoriesId", "PostsId")
|
||||
.HasName("pk_post_category_links");
|
||||
|
||||
b.HasIndex("PostsId")
|
||||
.HasDatabaseName("ix_post_category_links_posts_id");
|
||||
|
||||
b.ToTable("post_category_links", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostCollection", b =>
|
||||
{
|
||||
b.Property<long>("CollectionsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("collections_id");
|
||||
|
||||
b.Property<long>("PostsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("posts_id");
|
||||
|
||||
b.HasKey("CollectionsId", "PostsId")
|
||||
.HasName("pk_post_collection_links");
|
||||
|
||||
b.HasIndex("PostsId")
|
||||
.HasDatabaseName("ix_post_collection_links_posts_id");
|
||||
|
||||
b.ToTable("post_collection_links", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostTag", b =>
|
||||
{
|
||||
b.Property<long>("PostsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("posts_id");
|
||||
|
||||
b.Property<long>("TagsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("tags_id");
|
||||
|
||||
b.HasKey("PostsId", "TagsId")
|
||||
.HasName("pk_post_tag_links");
|
||||
|
||||
b.HasIndex("TagsId")
|
||||
.HasDatabaseName("ix_post_tag_links_tags_id");
|
||||
|
||||
b.ToTable("post_tag_links", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
|
||||
@ -839,11 +1059,30 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("fk_posts_posts_replied_post_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost")
|
||||
.WithOne()
|
||||
.HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId")
|
||||
.HasConstraintName("fk_posts_posts_threaded_post_id");
|
||||
|
||||
b.Navigation("ForwardedPost");
|
||||
|
||||
b.Navigation("Publisher");
|
||||
|
||||
b.Navigation("RepliedPost");
|
||||
|
||||
b.Navigation("ThreadedPost");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Publisher", "Publisher")
|
||||
.WithMany("Collections")
|
||||
.HasForeignKey("PublisherId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_collections_publishers_publisher_id");
|
||||
|
||||
b.Navigation("Publisher");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b =>
|
||||
@ -929,6 +1168,57 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.Navigation("Account");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostCategory", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_category_links_post_categories_categories_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Post", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("PostsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_category_links_posts_posts_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostCollection", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_collection_links_post_collections_collections_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Post", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("PostsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_collection_links_posts_posts_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostTag", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Post", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("PostsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_tag_links_posts_posts_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Sphere.Post.PostTag", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_tag_links_post_tags_tags_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b =>
|
||||
{
|
||||
b.Navigation("AuthFactors");
|
||||
@ -956,6 +1246,8 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b =>
|
||||
{
|
||||
b.Navigation("Collections");
|
||||
|
||||
b.Navigation("Members");
|
||||
|
||||
b.Navigation("Posts");
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NodaTime;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
@ -18,6 +19,40 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
type: "bigint",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "post_categories",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_post_categories", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "post_tags",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_post_tags", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "publishers",
|
||||
columns: table => new
|
||||
@ -55,6 +90,31 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "post_collections",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
publisher_id = table.Column<long>(type: "bigint", nullable: false),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_post_collections", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_post_collections_publishers_publisher_id",
|
||||
column: x => x.publisher_id,
|
||||
principalTable: "publishers",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "posts",
|
||||
columns: table => new
|
||||
@ -63,12 +123,18 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
title = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
|
||||
description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
language = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
|
||||
edited_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
published_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
visibility = table.Column<int>(type: "integer", nullable: false),
|
||||
content = table.Column<string>(type: "text", nullable: true),
|
||||
type = table.Column<int>(type: "integer", nullable: false),
|
||||
meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
|
||||
views_unique = table.Column<int>(type: "integer", nullable: false),
|
||||
views_total = table.Column<int>(type: "integer", nullable: false),
|
||||
upvotes = table.Column<int>(type: "integer", nullable: false),
|
||||
downvotes = table.Column<int>(type: "integer", nullable: false),
|
||||
threaded_post_id = table.Column<long>(type: "bigint", nullable: true),
|
||||
replied_post_id = table.Column<long>(type: "bigint", nullable: true),
|
||||
forwarded_post_id = table.Column<long>(type: "bigint", nullable: true),
|
||||
publisher_id = table.Column<long>(type: "bigint", nullable: false),
|
||||
@ -91,6 +157,11 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
principalTable: "posts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "fk_posts_posts_threaded_post_id",
|
||||
column: x => x.threaded_post_id,
|
||||
principalTable: "posts",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_posts_publishers_publisher_id",
|
||||
column: x => x.publisher_id,
|
||||
@ -128,6 +199,54 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "post_category_links",
|
||||
columns: table => new
|
||||
{
|
||||
categories_id = table.Column<long>(type: "bigint", nullable: false),
|
||||
posts_id = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_post_category_links", x => new { x.categories_id, x.posts_id });
|
||||
table.ForeignKey(
|
||||
name: "fk_post_category_links_post_categories_categories_id",
|
||||
column: x => x.categories_id,
|
||||
principalTable: "post_categories",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_post_category_links_posts_posts_id",
|
||||
column: x => x.posts_id,
|
||||
principalTable: "posts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "post_collection_links",
|
||||
columns: table => new
|
||||
{
|
||||
collections_id = table.Column<long>(type: "bigint", nullable: false),
|
||||
posts_id = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_post_collection_links", x => new { x.collections_id, x.posts_id });
|
||||
table.ForeignKey(
|
||||
name: "fk_post_collection_links_post_collections_collections_id",
|
||||
column: x => x.collections_id,
|
||||
principalTable: "post_collections",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_post_collection_links_posts_posts_id",
|
||||
column: x => x.posts_id,
|
||||
principalTable: "posts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "post_reactions",
|
||||
columns: table => new
|
||||
@ -159,11 +278,56 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "post_tag_links",
|
||||
columns: table => new
|
||||
{
|
||||
posts_id = table.Column<long>(type: "bigint", nullable: false),
|
||||
tags_id = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_post_tag_links", x => new { x.posts_id, x.tags_id });
|
||||
table.ForeignKey(
|
||||
name: "fk_post_tag_links_post_tags_tags_id",
|
||||
column: x => x.tags_id,
|
||||
principalTable: "post_tags",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_post_tag_links_posts_posts_id",
|
||||
column: x => x.posts_id,
|
||||
principalTable: "posts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_files_post_id",
|
||||
table: "files",
|
||||
column: "post_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_accounts_name",
|
||||
table: "accounts",
|
||||
column: "name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_post_category_links_posts_id",
|
||||
table: "post_category_links",
|
||||
column: "posts_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_post_collection_links_posts_id",
|
||||
table: "post_collection_links",
|
||||
column: "posts_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_post_collections_publisher_id",
|
||||
table: "post_collections",
|
||||
column: "publisher_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_post_reactions_account_id",
|
||||
table: "post_reactions",
|
||||
@ -174,6 +338,11 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
table: "post_reactions",
|
||||
column: "post_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_post_tag_links_tags_id",
|
||||
table: "post_tag_links",
|
||||
column: "tags_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_posts_forwarded_post_id",
|
||||
table: "posts",
|
||||
@ -189,6 +358,12 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
table: "posts",
|
||||
column: "replied_post_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_posts_threaded_post_id",
|
||||
table: "posts",
|
||||
column: "threaded_post_id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_publisher_members_account_id",
|
||||
table: "publisher_members",
|
||||
@ -204,6 +379,12 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
table: "publishers",
|
||||
column: "background_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_publishers_name",
|
||||
table: "publishers",
|
||||
column: "name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_publishers_picture_id",
|
||||
table: "publishers",
|
||||
@ -224,12 +405,30 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
name: "fk_files_posts_post_id",
|
||||
table: "files");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "post_category_links");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "post_collection_links");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "post_reactions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "post_tag_links");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "publisher_members");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "post_categories");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "post_collections");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "post_tags");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "posts");
|
||||
|
||||
@ -240,6 +439,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
name: "ix_files_post_id",
|
||||
table: "files");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_accounts_name",
|
||||
table: "accounts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "post_id",
|
||||
table: "files");
|
@ -70,6 +70,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_accounts");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_accounts_name");
|
||||
|
||||
b.ToTable("accounts", (string)null);
|
||||
});
|
||||
|
||||
@ -416,10 +420,27 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("downvotes");
|
||||
|
||||
b.Property<Instant?>("EditedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("edited_at");
|
||||
|
||||
b.Property<long?>("ForwardedPostId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("forwarded_post_id");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("language");
|
||||
|
||||
b.Property<Dictionary<string, object>>("Meta")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("meta");
|
||||
|
||||
b.Property<Instant?>("PublishedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("published_at");
|
||||
|
||||
b.Property<long>("PublisherId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("publisher_id");
|
||||
@ -428,6 +449,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("replied_post_id");
|
||||
|
||||
b.Property<long?>("ThreadedPostId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("threaded_post_id");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(1024)
|
||||
.HasColumnType("character varying(1024)")
|
||||
@ -453,6 +478,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("views_unique");
|
||||
|
||||
b.Property<int>("Visibility")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("visibility");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_posts");
|
||||
|
||||
@ -465,9 +494,101 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.HasIndex("RepliedPostId")
|
||||
.HasDatabaseName("ix_posts_replied_post_id");
|
||||
|
||||
b.HasIndex("ThreadedPostId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_posts_threaded_post_id");
|
||||
|
||||
b.ToTable("posts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("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>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_post_categories");
|
||||
|
||||
b.ToTable("post_categories", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("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>("Description")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<long>("PublisherId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("publisher_id");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_post_collections");
|
||||
|
||||
b.HasIndex("PublisherId")
|
||||
.HasDatabaseName("ix_post_collections_publisher_id");
|
||||
|
||||
b.ToTable("post_collections", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@ -519,6 +640,44 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.ToTable("post_reactions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("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>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_post_tags");
|
||||
|
||||
b.ToTable("post_tags", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@ -582,6 +741,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.HasIndex("BackgroundId")
|
||||
.HasDatabaseName("ix_publishers_background_id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_publishers_name");
|
||||
|
||||
b.HasIndex("PictureId")
|
||||
.HasDatabaseName("ix_publishers_picture_id");
|
||||
|
||||
@ -711,6 +874,63 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.ToTable("files", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostCategory", b =>
|
||||
{
|
||||
b.Property<long>("CategoriesId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("categories_id");
|
||||
|
||||
b.Property<long>("PostsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("posts_id");
|
||||
|
||||
b.HasKey("CategoriesId", "PostsId")
|
||||
.HasName("pk_post_category_links");
|
||||
|
||||
b.HasIndex("PostsId")
|
||||
.HasDatabaseName("ix_post_category_links_posts_id");
|
||||
|
||||
b.ToTable("post_category_links", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostCollection", b =>
|
||||
{
|
||||
b.Property<long>("CollectionsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("collections_id");
|
||||
|
||||
b.Property<long>("PostsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("posts_id");
|
||||
|
||||
b.HasKey("CollectionsId", "PostsId")
|
||||
.HasName("pk_post_collection_links");
|
||||
|
||||
b.HasIndex("PostsId")
|
||||
.HasDatabaseName("ix_post_collection_links_posts_id");
|
||||
|
||||
b.ToTable("post_collection_links", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostTag", b =>
|
||||
{
|
||||
b.Property<long>("PostsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("posts_id");
|
||||
|
||||
b.Property<long>("TagsId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("tags_id");
|
||||
|
||||
b.HasKey("PostsId", "TagsId")
|
||||
.HasName("pk_post_tag_links");
|
||||
|
||||
b.HasIndex("TagsId")
|
||||
.HasDatabaseName("ix_post_tag_links_tags_id");
|
||||
|
||||
b.ToTable("post_tag_links", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Account.Account", "Account")
|
||||
@ -836,11 +1056,30 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("fk_posts_posts_replied_post_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost")
|
||||
.WithOne()
|
||||
.HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId")
|
||||
.HasConstraintName("fk_posts_posts_threaded_post_id");
|
||||
|
||||
b.Navigation("ForwardedPost");
|
||||
|
||||
b.Navigation("Publisher");
|
||||
|
||||
b.Navigation("RepliedPost");
|
||||
|
||||
b.Navigation("ThreadedPost");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Publisher", "Publisher")
|
||||
.WithMany("Collections")
|
||||
.HasForeignKey("PublisherId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_collections_publishers_publisher_id");
|
||||
|
||||
b.Navigation("Publisher");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b =>
|
||||
@ -926,6 +1165,57 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.Navigation("Account");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostCategory", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_category_links_post_categories_categories_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Post", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("PostsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_category_links_posts_posts_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostCollection", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_collection_links_post_collections_collections_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Post", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("PostsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_collection_links_posts_posts_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PostPostTag", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Post.Post", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("PostsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_tag_links_posts_posts_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Sphere.Post.PostTag", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_post_tag_links_post_tags_tags_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b =>
|
||||
{
|
||||
b.Navigation("AuthFactors");
|
||||
@ -953,6 +1243,8 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b =>
|
||||
{
|
||||
b.Navigation("Collections");
|
||||
|
||||
b.Navigation("Members");
|
||||
|
||||
b.Navigation("Posts");
|
||||
|
Reference in New Issue
Block a user