divan/RMuseum/Migrations/20220108165707_UserVisitsModel.cs
2022-01-08 20:38:21 +03:30

55 lines
2.0 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RMuseum.Migrations
{
public partial class UserVisitsModel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GanjoorUserPoemVisits",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
PoemId = table.Column<int>(type: "int", nullable: false),
DateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GanjoorUserPoemVisits", x => x.Id);
table.ForeignKey(
name: "FK_GanjoorUserPoemVisits_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_GanjoorUserPoemVisits_GanjoorPoems_PoemId",
column: x => x.PoemId,
principalTable: "GanjoorPoems",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_GanjoorUserPoemVisits_PoemId",
table: "GanjoorUserPoemVisits",
column: "PoemId");
migrationBuilder.CreateIndex(
name: "IX_GanjoorUserPoemVisits_UserId",
table: "GanjoorUserPoemVisits",
column: "UserId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GanjoorUserPoemVisits");
}
}
}