using System; using Microsoft.EntityFrameworkCore.Migrations; namespace Infrastructure.Migrations { public partial class AddCommentVotes : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "comment_votes", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), CommentId = table.Column(type: "TEXT", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false), Direction = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_comment_votes", x => new { x.CommentId, x.Id }); table.ForeignKey( name: "FK_comment_votes_comments_CommentId", column: x => x.CommentId, principalTable: "comments", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "comment_votes"); } } }