postit and them also

This commit is contained in:
Paul Schneider 2026-06-10 00:23:17 +01:00
commit fa7d6242f1
18 changed files with 5322 additions and 121 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,69 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Yavsc.Migrations
{
/// <inheritdoc />
public partial class AddBlogFileAttachments : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "UploadedFiles",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Path = table.Column<string>(type: "text", nullable: true),
Length = table.Column<long>(type: "bigint", nullable: false),
ContentType = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UploadedFiles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "BlogAttachedFiles",
columns: table => new
{
FileId = table.Column<long>(type: "bigint", nullable: false),
PostId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BlogAttachedFiles", x => new { x.FileId, x.PostId });
table.ForeignKey(
name: "FK_BlogAttachedFiles_BlogSpot_PostId",
column: x => x.PostId,
principalTable: "BlogSpot",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BlogAttachedFiles_UploadedFiles_FileId",
column: x => x.FileId,
principalTable: "UploadedFiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_BlogAttachedFiles_PostId",
table: "BlogAttachedFiles",
column: "PostId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BlogAttachedFiles");
migrationBuilder.DropTable(
name: "UploadedFiles");
}
}
}

View file

@ -1413,6 +1413,21 @@ namespace Yavsc.Migrations
b.ToTable("ExceptionsSIREN");
});
modelBuilder.Entity("Yavsc.Models.Blog.BlogAttachedFile", b =>
{
b.Property<long>("FileId")
.HasColumnType("bigint");
b.Property<long>("PostId")
.HasColumnType("bigint");
b.HasKey("FileId", "PostId");
b.HasIndex("PostId");
b.ToTable("BlogAttachedFiles");
});
modelBuilder.Entity("Yavsc.Models.Blog.BlogPost", b =>
{
b.Property<long>("Id")
@ -1518,6 +1533,28 @@ namespace Yavsc.Migrations
b.ToTable("Comment");
});
modelBuilder.Entity("Yavsc.Models.Blog.UploadedFile", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ContentType")
.HasColumnType("text");
b.Property<long>("Length")
.HasColumnType("bigint");
b.Property<string>("Path")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("UploadedFiles");
});
modelBuilder.Entity("Yavsc.Models.BlogSpotPublication", b =>
{
b.Property<long>("BlogpostId")
@ -3700,6 +3737,25 @@ namespace Yavsc.Migrations
b.Navigation("Query");
});
modelBuilder.Entity("Yavsc.Models.Blog.BlogAttachedFile", b =>
{
b.HasOne("Yavsc.Models.Blog.UploadedFile", "File")
.WithMany()
.HasForeignKey("FileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yavsc.Models.Blog.BlogPost", "Post")
.WithMany()
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("File");
b.Navigation("Post");
});
modelBuilder.Entity("Yavsc.Models.Blog.BlogPost", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser", "Author")