🗃️ Add post award database
This commit is contained in:
		
							
								
								
									
										2133
									
								
								DysonNetwork.Sphere/Migrations/20250904162157_AddPostAwardScore.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										2133
									
								
								DysonNetwork.Sphere/Migrations/20250904162157_AddPostAwardScore.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -0,0 +1,64 @@ | |||||||
|  | using System; | ||||||
|  | using Microsoft.EntityFrameworkCore.Migrations; | ||||||
|  | using NodaTime; | ||||||
|  |  | ||||||
|  | #nullable disable | ||||||
|  |  | ||||||
|  | namespace DysonNetwork.Sphere.Migrations | ||||||
|  | { | ||||||
|  |     /// <inheritdoc /> | ||||||
|  |     public partial class AddPostAwardScore : Migration | ||||||
|  |     { | ||||||
|  |         /// <inheritdoc /> | ||||||
|  |         protected override void Up(MigrationBuilder migrationBuilder) | ||||||
|  |         { | ||||||
|  |             migrationBuilder.AddColumn<decimal>( | ||||||
|  |                 name: "awarded_score", | ||||||
|  |                 table: "posts", | ||||||
|  |                 type: "numeric", | ||||||
|  |                 nullable: false, | ||||||
|  |                 defaultValue: 0m); | ||||||
|  |  | ||||||
|  |             migrationBuilder.CreateTable( | ||||||
|  |                 name: "post_awards", | ||||||
|  |                 columns: table => new | ||||||
|  |                 { | ||||||
|  |                     id = table.Column<Guid>(type: "uuid", nullable: false), | ||||||
|  |                     amount = table.Column<decimal>(type: "numeric", nullable: false), | ||||||
|  |                     attitude = table.Column<int>(type: "integer", nullable: false), | ||||||
|  |                     message = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true), | ||||||
|  |                     post_id = table.Column<Guid>(type: "uuid", nullable: false), | ||||||
|  |                     account_id = table.Column<Guid>(type: "uuid", 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_awards", x => x.id); | ||||||
|  |                     table.ForeignKey( | ||||||
|  |                         name: "fk_post_awards_posts_post_id", | ||||||
|  |                         column: x => x.post_id, | ||||||
|  |                         principalTable: "posts", | ||||||
|  |                         principalColumn: "id", | ||||||
|  |                         onDelete: ReferentialAction.Cascade); | ||||||
|  |                 }); | ||||||
|  |  | ||||||
|  |             migrationBuilder.CreateIndex( | ||||||
|  |                 name: "ix_post_awards_post_id", | ||||||
|  |                 table: "post_awards", | ||||||
|  |                 column: "post_id"); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         /// <inheritdoc /> | ||||||
|  |         protected override void Down(MigrationBuilder migrationBuilder) | ||||||
|  |         { | ||||||
|  |             migrationBuilder.DropTable( | ||||||
|  |                 name: "post_awards"); | ||||||
|  |  | ||||||
|  |             migrationBuilder.DropColumn( | ||||||
|  |                 name: "awarded_score", | ||||||
|  |                 table: "posts"); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -529,6 +529,10 @@ namespace DysonNetwork.Sphere.Migrations | |||||||
|                         .HasColumnType("jsonb") |                         .HasColumnType("jsonb") | ||||||
|                         .HasColumnName("attachments"); |                         .HasColumnName("attachments"); | ||||||
|  |  | ||||||
|  |                     b.Property<decimal>("AwardedScore") | ||||||
|  |                         .HasColumnType("numeric") | ||||||
|  |                         .HasColumnName("awarded_score"); | ||||||
|  |  | ||||||
|                     b.Property<string>("Content") |                     b.Property<string>("Content") | ||||||
|                         .HasColumnType("text") |                         .HasColumnType("text") | ||||||
|                         .HasColumnName("content"); |                         .HasColumnName("content"); | ||||||
| @@ -659,6 +663,55 @@ namespace DysonNetwork.Sphere.Migrations | |||||||
|                     b.ToTable("posts", (string)null); |                     b.ToTable("posts", (string)null); | ||||||
|                 }); |                 }); | ||||||
|  |  | ||||||
|  |             modelBuilder.Entity("DysonNetwork.Sphere.Post.PostAward", b => | ||||||
|  |                 { | ||||||
|  |                     b.Property<Guid>("Id") | ||||||
|  |                         .ValueGeneratedOnAdd() | ||||||
|  |                         .HasColumnType("uuid") | ||||||
|  |                         .HasColumnName("id"); | ||||||
|  |  | ||||||
|  |                     b.Property<Guid>("AccountId") | ||||||
|  |                         .HasColumnType("uuid") | ||||||
|  |                         .HasColumnName("account_id"); | ||||||
|  |  | ||||||
|  |                     b.Property<decimal>("Amount") | ||||||
|  |                         .HasColumnType("numeric") | ||||||
|  |                         .HasColumnName("amount"); | ||||||
|  |  | ||||||
|  |                     b.Property<int>("Attitude") | ||||||
|  |                         .HasColumnType("integer") | ||||||
|  |                         .HasColumnName("attitude"); | ||||||
|  |  | ||||||
|  |                     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>("Message") | ||||||
|  |                         .HasMaxLength(4096) | ||||||
|  |                         .HasColumnType("character varying(4096)") | ||||||
|  |                         .HasColumnName("message"); | ||||||
|  |  | ||||||
|  |                     b.Property<Guid>("PostId") | ||||||
|  |                         .HasColumnType("uuid") | ||||||
|  |                         .HasColumnName("post_id"); | ||||||
|  |  | ||||||
|  |                     b.Property<Instant>("UpdatedAt") | ||||||
|  |                         .HasColumnType("timestamp with time zone") | ||||||
|  |                         .HasColumnName("updated_at"); | ||||||
|  |  | ||||||
|  |                     b.HasKey("Id") | ||||||
|  |                         .HasName("pk_post_awards"); | ||||||
|  |  | ||||||
|  |                     b.HasIndex("PostId") | ||||||
|  |                         .HasDatabaseName("ix_post_awards_post_id"); | ||||||
|  |  | ||||||
|  |                     b.ToTable("post_awards", (string)null); | ||||||
|  |                 }); | ||||||
|  |  | ||||||
|             modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => |             modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<Guid>("Id") |                     b.Property<Guid>("Id") | ||||||
| @@ -1770,6 +1823,18 @@ namespace DysonNetwork.Sphere.Migrations | |||||||
|                     b.Navigation("RepliedPost"); |                     b.Navigation("RepliedPost"); | ||||||
|                 }); |                 }); | ||||||
|  |  | ||||||
|  |             modelBuilder.Entity("DysonNetwork.Sphere.Post.PostAward", b => | ||||||
|  |                 { | ||||||
|  |                     b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") | ||||||
|  |                         .WithMany("Awards") | ||||||
|  |                         .HasForeignKey("PostId") | ||||||
|  |                         .OnDelete(DeleteBehavior.Cascade) | ||||||
|  |                         .IsRequired() | ||||||
|  |                         .HasConstraintName("fk_post_awards_posts_post_id"); | ||||||
|  |  | ||||||
|  |                     b.Navigation("Post"); | ||||||
|  |                 }); | ||||||
|  |  | ||||||
|             modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategorySubscription", b => |             modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategorySubscription", b => | ||||||
|                 { |                 { | ||||||
|                     b.HasOne("DysonNetwork.Sphere.Post.PostCategory", "Category") |                     b.HasOne("DysonNetwork.Sphere.Post.PostCategory", "Category") | ||||||
| @@ -2021,6 +2086,8 @@ namespace DysonNetwork.Sphere.Migrations | |||||||
|  |  | ||||||
|             modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => |             modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => | ||||||
|                 { |                 { | ||||||
|  |                     b.Navigation("Awards"); | ||||||
|  |  | ||||||
|                     b.Navigation("Reactions"); |                     b.Navigation("Reactions"); | ||||||
|                 }); |                 }); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user