using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Diligent.WebAPI.Data.Migrations { public partial class UserCategoryManyToMany : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "UserCategories", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(type: "int", nullable: false), CategoryId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserCategories", x => x.Id); table.ForeignKey( name: "FK_UserCategories_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_UserCategories_Categories_CategoryId", column: x => x.CategoryId, principalTable: "Categories", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_UserCategories_CategoryId", table: "UserCategories", column: "CategoryId"); migrationBuilder.CreateIndex( name: "IX_UserCategories_UserId", table: "UserCategories", column: "UserId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "UserCategories"); } } }