using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations.AppDb { /// public partial class AddPostCheer : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "Reward_CheerDailyMax", table: "Config", type: "int", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "Reward_CheerFeePercent", table: "Config", type: "int", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "Reward_CheerMinAmount", table: "Config", type: "int", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "PostCheer", columns: table => new { ID = table.Column(type: "int", nullable: false, comment: "PK") .Annotation("SqlServer:Identity", "1, 1"), PostID = table.Column(type: "int", nullable: false, comment: "응원 대상 게시글 ID"), FromMemberID = table.Column(type: "int", nullable: false, comment: "응원 발신자 회원 ID"), ToMemberID = table.Column(type: "int", nullable: false, comment: "응원 수신자(글 작성자) 회원 ID"), Amount = table.Column(type: "int", nullable: false, comment: "총 응원 금액"), FeeAmount = table.Column(type: "int", nullable: false, comment: "플랫폼 수수료(소각분)"), NetAmount = table.Column(type: "int", nullable: false, comment: "작성자 수령 순액(Reward 적립)"), Message = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "응원 한마디"), CreatedAt = table.Column(type: "datetime2", nullable: false, comment: "응원 일시") }, constraints: table => { table.PrimaryKey("PK_PostCheer", x => x.ID); table.ForeignKey( name: "FK_PostCheer_Member_FromMemberID", column: x => x.FromMemberID, principalTable: "Member", principalColumn: "ID"); table.ForeignKey( name: "FK_PostCheer_Member_ToMemberID", column: x => x.ToMemberID, principalTable: "Member", principalColumn: "ID"); table.ForeignKey( name: "FK_PostCheer_Post_PostID", column: x => x.PostID, principalTable: "Post", principalColumn: "ID"); }, comment: "분석글 응원(Cheer) — D3 M4"); migrationBuilder.CreateIndex( name: "IX_PostCheer_FromMemberID_CreatedAt", table: "PostCheer", columns: new[] { "FromMemberID", "CreatedAt" }); migrationBuilder.CreateIndex( name: "IX_PostCheer_PostID", table: "PostCheer", column: "PostID"); migrationBuilder.CreateIndex( name: "IX_PostCheer_ToMemberID_CreatedAt", table: "PostCheer", columns: new[] { "ToMemberID", "CreatedAt" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "PostCheer"); migrationBuilder.DropColumn( name: "Reward_CheerDailyMax", table: "Config"); migrationBuilder.DropColumn( name: "Reward_CheerFeePercent", table: "Config"); migrationBuilder.DropColumn( name: "Reward_CheerMinAmount", table: "Config"); } } }