You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.8 KiB
90 lines
2.8 KiB
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace StubbedContextLib.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class migr2 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
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);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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");
|
|
}
|
|
}
|
|
}
|