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(type: "TEXT", nullable: false), LinkId = table.Column(type: "TEXT", nullable: false), Content = table.Column(type: "TEXT", nullable: false), CreatedAt = table.Column(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"); } } }