120 lines
4.8 KiB
C#
120 lines
4.8 KiB
C#
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
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class add_PaymentConfig : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterColumn<DateTime>(
|
|
name: "UpdatedAt",
|
|
table: "Orders",
|
|
type: "datetime(6)",
|
|
nullable: true,
|
|
oldClrType: typeof(DateTime),
|
|
oldType: "datetime(6)");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "PaiAt",
|
|
table: "Orders",
|
|
type: "datetime(6)",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "PaymentType",
|
|
table: "Orders",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PaymentConfig",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Method = table.Column<int>(type: "int", nullable: false),
|
|
AppId = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
SecretKey = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PublicKey = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
NotifyUrl = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
GatewayUrl = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
ExtraSettingsJson = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(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));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "PaymentConfig");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "PaiAt",
|
|
table: "Orders");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "PaymentType",
|
|
table: "Orders");
|
|
|
|
migrationBuilder.AlterColumn<DateTime>(
|
|
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));
|
|
}
|
|
}
|
|
}
|