176 lines
6.5 KiB
C#
176 lines
6.5 KiB
C#
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PSTW_CentralSystem.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class UpdateInventory2 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "Dept",
|
|
table: "Items");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ImageProduct",
|
|
table: "Items");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ProductCategory",
|
|
table: "Items");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ProductName",
|
|
table: "Items");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "ItemID",
|
|
table: "Items",
|
|
type: "varchar(255)",
|
|
nullable: false,
|
|
oldClrType: typeof(int),
|
|
oldType: "int")
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "DepartmentId",
|
|
table: "Items",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "ProductId",
|
|
table: "Items",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "AspNetUsers",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
|
values: new object[] { "566de32b-8ac7-4fd9-9e16-d239fcf61f33", "AQAAAAIAAYagAAAAEOs61no/950C9+WFQRSQg3Wssko80bGYfLBvlMN7EOcKf4Dj9TUFLjqAiM4jc7JKqg==", "25fbc2fb-3ac0-4a83-a4f4-4abbcf9d1942" });
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "AspNetUsers",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
|
values: new object[] { "58495e52-8212-49a5-929a-04a759a1eaae", "AQAAAAIAAYagAAAAEHI2wahcf8tCM2SlSfNPiluZtwp9QP2QOlom8Vc5L1FhbuZoex+1WlnhONaWtKHBZQ==", "be73a773-8c2d-4f23-9a79-cb5d106ac1d2" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Items_DepartmentId",
|
|
table: "Items",
|
|
column: "DepartmentId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Items_ProductId",
|
|
table: "Items",
|
|
column: "ProductId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Items_Departments_DepartmentId",
|
|
table: "Items",
|
|
column: "DepartmentId",
|
|
principalTable: "Departments",
|
|
principalColumn: "DepartmentId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Items_Products_ProductId",
|
|
table: "Items",
|
|
column: "ProductId",
|
|
principalTable: "Products",
|
|
principalColumn: "ProductId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Items_Departments_DepartmentId",
|
|
table: "Items");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Items_Products_ProductId",
|
|
table: "Items");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Items_DepartmentId",
|
|
table: "Items");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Items_ProductId",
|
|
table: "Items");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DepartmentId",
|
|
table: "Items");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ProductId",
|
|
table: "Items");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "ItemID",
|
|
table: "Items",
|
|
type: "int",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "varchar(255)")
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
|
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Dept",
|
|
table: "Items",
|
|
type: "longtext",
|
|
nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ImageProduct",
|
|
table: "Items",
|
|
type: "longtext",
|
|
nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ProductCategory",
|
|
table: "Items",
|
|
type: "longtext",
|
|
nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ProductName",
|
|
table: "Items",
|
|
type: "longtext",
|
|
nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "AspNetUsers",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
|
values: new object[] { "ca9d09a9-e64c-4e77-b4db-5f3a74347c2e", "AQAAAAIAAYagAAAAEE5O/c/d64bTFVIMdF4bXbFvJTX6o0Tfz5yMhUEHmWqKGGD+QR5awcQMkOxQrZiPyA==", "2d5b2076-6914-4946-b8d1-58d8b1739a41" });
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "AspNetUsers",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
|
values: new object[] { "29852249-ce04-40a3-b735-6aa3ec4d6fae", "AQAAAAIAAYagAAAAEIxZLeIlI9khL2sAGbA9ueokgHFkd1IKX4bYRAm9vCnd0gHCPfo4SAra5ageTh7aOg==", "889bcd81-6fec-42e5-ae31-77f759d3d88a" });
|
|
}
|
|
}
|
|
}
|