100 lines
3.8 KiB
C#
100 lines
3.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 addconfigTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "ExpiryDate",
|
|
table: "Apipackages");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "ExpiryDate",
|
|
table: "UserPackages",
|
|
type: "datetime(6)",
|
|
nullable: false,
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsDeleted",
|
|
table: "Apipackages",
|
|
type: "tinyint(1)",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "SystemConfigs",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
ConfigName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ConfigBody = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_SystemConfigs", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "SystemConfigs",
|
|
columns: new[] { "Id", "ConfigBody", "ConfigName" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "青蓝", "SystemName" },
|
|
{ 2, "描述", "SystemDescription" },
|
|
{ 3, "", "LogoLocation" },
|
|
{ 4, "", "FaviconLocation" },
|
|
{ 5, "13000000000", "Phone" },
|
|
{ 6, "admin@admin.com", "Email" },
|
|
{ 7, "{\"RegisterOn\":true,\"Emailvalidate\":true}", "RegisterConfig" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Users",
|
|
columns: new[] { "Id", "ApiKey", "Balance", "CreatedAt", "Email", "IsBan", "IsDelete", "PassHash", "Username" },
|
|
values: new object[] { -1, null, 0m, new DateTime(2024, 11, 10, 13, 48, 10, 873, DateTimeKind.Utc).AddTicks(7811), "admin1@admin.com", false, false, "e10adc3949ba59abbe56e057f20f883e", "admin" });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "SystemConfigs");
|
|
|
|
migrationBuilder.DeleteData(
|
|
table: "Users",
|
|
keyColumn: "Id",
|
|
keyValue: -1);
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ExpiryDate",
|
|
table: "UserPackages");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "IsDeleted",
|
|
table: "Apipackages");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "ExpiryDate",
|
|
table: "Apipackages",
|
|
type: "datetime(6)",
|
|
nullable: false,
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
|
}
|
|
}
|
|
}
|