using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional namespace StubbedContextLib.Migrations { /// public partial class migr2 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "IdImage", table: "Users", type: "int", nullable: false, defaultValue: 0); migrationBuilder.InsertData( table: "Images", columns: new[] { "Id", "ImgPath" }, values: new object[,] { { 1, "coucou" }, { 2, "bonjour" } }); migrationBuilder.UpdateData( table: "Users", keyColumn: "Id", keyValue: 1, column: "IdImage", value: 1); migrationBuilder.InsertData( table: "Users", columns: new[] { "Id", "Created", "Email", "IdImage", "Password", "UserName" }, values: new object[] { 2, new DateTime(2000, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "admin@gmail.com", 1, "1234", "Admin" }); migrationBuilder.CreateIndex( name: "IX_Users_IdImage", table: "Users", column: "IdImage"); migrationBuilder.AddForeignKey( name: "FK_Users_Images_IdImage", table: "Users", column: "IdImage", principalTable: "Images", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Users_Images_IdImage", table: "Users"); migrationBuilder.DropIndex( name: "IX_Users_IdImage", table: "Users"); migrationBuilder.DeleteData( table: "Images", keyColumn: "Id", keyValue: 2); migrationBuilder.DeleteData( table: "Users", keyColumn: "Id", keyValue: 2); migrationBuilder.DeleteData( table: "Images", keyColumn: "Id", keyValue: 1); migrationBuilder.DropColumn( name: "IdImage", table: "Users"); } } }