myhn/Infrastructure/Migrations/20210108110502_AddCommentVotes.cs
2021-01-08 16:26:19 +01:00

38 lines
1.4 KiB
C#

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<Guid>(type: "TEXT", nullable: false),
CommentId = table.Column<Guid>(type: "TEXT", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
Direction = table.Column<int>(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");
}
}
}