213 lines
11 KiB
C#
213 lines
11 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PSTW_CentralSystem.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class UpdateInventory : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Companies",
|
|
columns: table => new
|
|
{
|
|
CompanyId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Companies", x => x.CompanyId);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Suppliers",
|
|
columns: table => new
|
|
{
|
|
SupplierId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
SupplierName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
SupplierGender = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
SupplierEmail = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
SupplierPhoneNo = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Suppliers", x => x.SupplierId);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Departments",
|
|
columns: table => new
|
|
{
|
|
DepartmentId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
CompanyId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Departments", x => x.DepartmentId);
|
|
table.ForeignKey(
|
|
name: "FK_Departments_Companies_CompanyId",
|
|
column: x => x.CompanyId,
|
|
principalTable: "Companies",
|
|
principalColumn: "CompanyId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Items",
|
|
columns: table => new
|
|
{
|
|
ItemID = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
CompanyId = table.Column<int>(type: "int", nullable: false),
|
|
Dept = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ProductName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ImageProduct = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ProductCategory = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
SerialNumber = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Quantity = table.Column<int>(type: "int", nullable: false),
|
|
Supplier = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PurchaseDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
PONo = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Currency = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PriceInRM = table.Column<float>(type: "float", nullable: false),
|
|
CurrencyRate = table.Column<float>(type: "float", nullable: false),
|
|
ConvertPrice = table.Column<float>(type: "float", nullable: false),
|
|
DODate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
Warranty = table.Column<int>(type: "int", nullable: false),
|
|
EndWDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
InvoiceDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Items", x => x.ItemID);
|
|
table.ForeignKey(
|
|
name: "FK_Items_Companies_CompanyId",
|
|
column: x => x.CompanyId,
|
|
principalTable: "Companies",
|
|
principalColumn: "CompanyId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Products",
|
|
columns: table => new
|
|
{
|
|
ProductId = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
ProductName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Manufacturer = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Category = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ModelNo = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
QuantityProduct = table.Column<int>(type: "int", nullable: false),
|
|
ImageProduct = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
CompanyId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Products", x => x.ProductId);
|
|
table.ForeignKey(
|
|
name: "FK_Products_Companies_CompanyId",
|
|
column: x => x.CompanyId,
|
|
principalTable: "Companies",
|
|
principalColumn: "CompanyId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.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" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Departments_CompanyId",
|
|
table: "Departments",
|
|
column: "CompanyId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Items_CompanyId",
|
|
table: "Items",
|
|
column: "CompanyId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Products_CompanyId",
|
|
table: "Products",
|
|
column: "CompanyId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Departments");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Items");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Products");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Suppliers");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Companies");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "AspNetUsers",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
|
values: new object[] { "f79b6001-14b2-4a38-9053-260da45ada52", "AQAAAAIAAYagAAAAEOYjD3O+nyYU9Fk9q39d6tSeunezi9sWZCz4DbTkHsR6Dc7+FOkgYtFdC/SUbQY6qw==", "7d64818d-d890-4c39-9bf9-f74c69fcfb1b" });
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "AspNetUsers",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
|
values: new object[] { "bdf8a940-37e3-4c91-9f3e-c69d9aaea315", "AQAAAAIAAYagAAAAEG8sIA+qY2dDrUrmX4jmFgKojC/X8pT9bv60D+yIy93/8vNy6qmRgLqebYjkZ1CjVw==", "07ca3eae-b820-4219-b52f-7957244e272f" });
|
|
}
|
|
}
|
|
}
|