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

43 lines
1.5 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Infrastructure.Migrations
{
public partial class AddLinkVote : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "link_votes",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
Direction = table.Column<int>(type: "INTEGER", nullable: false),
LinkId = table.Column<Guid>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_link_votes", x => x.Id);
table.ForeignKey(
name: "FK_link_votes_links_LinkId",
column: x => x.LinkId,
principalTable: "links",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_link_votes_LinkId",
table: "link_votes",
column: "LinkId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "link_votes");
}
}
}