using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional namespace Apimanager_backend.Migrations { /// public partial class add_PaymentConfig : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "UpdatedAt", table: "Orders", type: "datetime(6)", nullable: true, oldClrType: typeof(DateTime), oldType: "datetime(6)"); migrationBuilder.AddColumn( name: "PaiAt", table: "Orders", type: "datetime(6)", nullable: true); migrationBuilder.AddColumn( name: "PaymentType", table: "Orders", type: "int", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "PaymentConfig", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Method = table.Column(type: "int", nullable: false), AppId = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), SecretKey = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), PublicKey = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), NotifyUrl = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), GatewayUrl = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), ExtraSettingsJson = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_PaymentConfig", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.InsertData( table: "PaymentConfig", columns: new[] { "Id", "AppId", "Description", "ExtraSettingsJson", "GatewayUrl", "IsEnabled", "Method", "NotifyUrl", "PublicKey", "SecretKey" }, values: new object[,] { { 1, "", null, null, "", false, 0, "", "", "" }, { 2, "", null, null, "", false, 1, "", "", "" }, { 3, "", null, null, "", false, 3, "", "", "" }, { 4, "", null, null, "", false, 2, "", "", "" }, { 5, "", null, null, "", false, 4, "", "", "" } }); migrationBuilder.UpdateData( table: "Users", keyColumn: "Id", keyValue: -1, column: "CreatedAt", value: new DateTime(2025, 7, 29, 8, 1, 0, 284, DateTimeKind.Utc).AddTicks(4585)); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "PaymentConfig"); migrationBuilder.DropColumn( name: "PaiAt", table: "Orders"); migrationBuilder.DropColumn( name: "PaymentType", table: "Orders"); migrationBuilder.AlterColumn( name: "UpdatedAt", table: "Orders", type: "datetime(6)", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), oldClrType: typeof(DateTime), oldType: "datetime(6)", oldNullable: true); migrationBuilder.UpdateData( table: "Users", keyColumn: "Id", keyValue: -1, column: "CreatedAt", value: new DateTime(2025, 7, 28, 12, 44, 13, 79, DateTimeKind.Utc).AddTicks(8845)); } } }