Files
mapo-core/MP.Data/Migrations/MoonPro_Utils/20260408062523_InitDb.cs
T

76 lines
3.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MP.Data.Migrations.MoonPro_Utils
{
public partial class InitDb : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "stats_aggr",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Destination = table.Column<string>(type: "nvarchar(450)", nullable: true),
Hour = table.Column<DateTime>(type: "datetime2", nullable: false),
RequestCount = table.Column<long>(type: "bigint", nullable: false),
AvgDuration = table.Column<double>(type: "float", nullable: false),
MinDuration = table.Column<double>(type: "float", nullable: false),
MaxDuration = table.Column<double>(type: "float", nullable: false),
NoReply = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_stats_aggr", x => x.Id);
});
migrationBuilder.CreateTable(
name: "stats_detail",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Destination = table.Column<string>(type: "nvarchar(450)", nullable: true),
Type = table.Column<string>(type: "nvarchar(450)", nullable: true),
Hour = table.Column<DateTime>(type: "datetime2", nullable: false),
RequestCount = table.Column<long>(type: "bigint", nullable: false),
AvgDuration = table.Column<double>(type: "float", nullable: false),
MinDuration = table.Column<double>(type: "float", nullable: false),
MaxDuration = table.Column<double>(type: "float", nullable: false),
NoReply = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_stats_detail", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "idx_statsaggr_env_hour",
table: "stats_aggr",
columns: new[] { "Destination", "Hour" },
unique: true,
filter: "[Destination] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "idx_statsdet_hour_env_type",
table: "stats_detail",
columns: new[] { "Destination", "Type", "Hour" },
unique: true,
filter: "[Destination] IS NOT NULL AND [Type] IS NOT NULL");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "stats_aggr");
migrationBuilder.DropTable(
name: "stats_detail");
}
}
}