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(type: "uniqueidentifier", nullable: false), UserId = table.Column(type: "uniqueidentifier", nullable: true), PoemId = table.Column(type: "int", nullable: false), DateTime = table.Column(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"); } } }