using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PSTW_CentralSystem.Migrations { /// public partial class UpdateDatabaseChanges : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.RenameColumn( name: "SupplierName", table: "Suppliers", newName: "SupplierCompName"); migrationBuilder.RenameColumn( name: "SupplierGender", table: "Suppliers", newName: "SupplierAddress"); migrationBuilder.AlterColumn( name: "SupplierPhoneNo", table: "Suppliers", type: "longtext", nullable: true, oldClrType: typeof(string), oldType: "longtext") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "SupplierEmail", table: "Suppliers", type: "longtext", nullable: true, oldClrType: typeof(string), oldType: "longtext") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "SupplierPIC", table: "Suppliers", type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "ProductShortName", table: "Products", type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "PartNumber", table: "Items", type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "Request", columns: table => new { requestId = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), remark = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), status = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), requestDate = table.Column(type: "datetime(6)", nullable: false), approvalDate = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Request", x => x.requestId); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.UpdateData( table: "AspNetUsers", keyColumn: "Id", keyValue: 1, columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, values: new object[] { "6b8e8dbd-4380-4e8c-aa0b-1c1fffc3059c", "AQAAAAIAAYagAAAAEFKtr2LZjKgfLzY44m8cVW4qpdwci45lnh/t3ioymIh6Ib6c85ne3QGfnUAyERwMWg==", "79e606c8-032b-426b-8fb2-7727b93823eb" }); migrationBuilder.UpdateData( table: "AspNetUsers", keyColumn: "Id", keyValue: 2, columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, values: new object[] { "8bf46c63-d7df-4ac5-bab2-fc15fe881302", "AQAAAAIAAYagAAAAEB/4JzIPKQK76gM4+Ddc948BoBumC8oa2Ya4odgM4r6P+LNaWRaLOaFG4bp0Iya9Sg==", "5ac5ec31-c25f-4a7a-8057-664ecdf76108" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Request"); migrationBuilder.DropColumn( name: "SupplierPIC", table: "Suppliers"); migrationBuilder.DropColumn( name: "ProductShortName", table: "Products"); migrationBuilder.DropColumn( name: "PartNumber", table: "Items"); migrationBuilder.RenameColumn( name: "SupplierCompName", table: "Suppliers", newName: "SupplierName"); migrationBuilder.RenameColumn( name: "SupplierAddress", table: "Suppliers", newName: "SupplierGender"); migrationBuilder.UpdateData( table: "Suppliers", keyColumn: "SupplierPhoneNo", keyValue: null, column: "SupplierPhoneNo", value: ""); migrationBuilder.AlterColumn( name: "SupplierPhoneNo", table: "Suppliers", type: "longtext", nullable: false, oldClrType: typeof(string), oldType: "longtext", oldNullable: true) .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.UpdateData( table: "Suppliers", keyColumn: "SupplierEmail", keyValue: null, column: "SupplierEmail", value: ""); migrationBuilder.AlterColumn( name: "SupplierEmail", table: "Suppliers", type: "longtext", nullable: false, oldClrType: typeof(string), oldType: "longtext", oldNullable: true) .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.UpdateData( table: "AspNetUsers", keyColumn: "Id", keyValue: 1, columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, values: new object[] { "4c8e81ae-2e43-4f98-82a0-4d7c4aa6d011", "AQAAAAIAAYagAAAAEKr0d9Fe168hXvdX6+oJvbfo2QHFsp8i/EQjhLbkWRn/yvKImJa6XzZ5KJ6qohTE1w==", "2219ec34-d4a0-496b-a7d7-e6c5d7b2a222" }); migrationBuilder.UpdateData( table: "AspNetUsers", keyColumn: "Id", keyValue: 2, columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, values: new object[] { "bcc1500e-9ae2-4704-9997-dbe646d2fa7a", "AQAAAAIAAYagAAAAEE3CUAWzIeL592V5xPyAD5ciHe8OGtvbNHhU6UNafDMT/+0R77o6UCDj/K8wc0j0Xw==", "7c582e0d-8237-4605-8fec-449bbe78f6c9" }); } } }