43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace Infrastructure.Migrations
|
|
{
|
|
public partial class AddCommentEntity : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "comments",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
|
LinkId = table.Column<Guid>(type: "TEXT", nullable: false),
|
|
Content = table.Column<string>(type: "TEXT", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_comments", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_comments_links_LinkId",
|
|
column: x => x.LinkId,
|
|
principalTable: "links",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_comments_LinkId",
|
|
table: "comments",
|
|
column: "LinkId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "comments");
|
|
}
|
|
}
|
|
}
|