1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

change table design for rating history

This commit is contained in:
RaidMax
2018-05-31 19:17:52 -05:00
parent dca4d10967
commit 76d15e488e
10 changed files with 283 additions and 401 deletions

View File

@ -1,139 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace SharedLibraryCore.Migrations
{
public partial class AddAutomatedOffenseAndRatingHistory : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "AutomatedOffense",
table: "EFPenalties",
nullable: true);
migrationBuilder.CreateTable(
name: "EFClientAverageStatHistory",
columns: table => new
{
ClientId = table.Column<int>(nullable: false),
Active = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFClientAverageStatHistory", x => x.ClientId);
table.ForeignKey(
name: "FK_EFClientAverageStatHistory_EFClients_ClientId",
column: x => x.ClientId,
principalTable: "EFClients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EFClientStatHistory",
columns: table => new
{
StatHistoryId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
ClientId = table.Column<int>(nullable: false),
ServerId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFClientStatHistory", x => x.StatHistoryId);
table.ForeignKey(
name: "FK_EFClientStatHistory_EFClients_ClientId",
column: x => x.ClientId,
principalTable: "EFClients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EFClientStatHistory_EFServers_ServerId",
column: x => x.ServerId,
principalTable: "EFServers",
principalColumn: "ServerId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EFRating",
columns: table => new
{
RatingId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
ClientId = table.Column<int>(nullable: false),
EFClientAverageStatHistoryClientId = table.Column<int>(nullable: true),
EFClientStatHistoryStatHistoryId = table.Column<int>(nullable: true),
Performance = table.Column<double>(nullable: false),
Ranking = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFRating", x => x.RatingId);
table.ForeignKey(
name: "FK_EFRating_EFClients_ClientId",
column: x => x.ClientId,
principalTable: "EFClients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EFRating_EFClientAverageStatHistory_EFClientAverageStatHistoryClientId",
column: x => x.EFClientAverageStatHistoryClientId,
principalTable: "EFClientAverageStatHistory",
principalColumn: "ClientId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_EFRating_EFClientStatHistory_EFClientStatHistoryStatHistoryId",
column: x => x.EFClientStatHistoryStatHistoryId,
principalTable: "EFClientStatHistory",
principalColumn: "StatHistoryId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_EFClientStatHistory_ClientId",
table: "EFClientStatHistory",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_EFClientStatHistory_ServerId",
table: "EFClientStatHistory",
column: "ServerId");
migrationBuilder.CreateIndex(
name: "IX_EFRating_ClientId",
table: "EFRating",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_EFRating_EFClientAverageStatHistoryClientId",
table: "EFRating",
column: "EFClientAverageStatHistoryClientId");
migrationBuilder.CreateIndex(
name: "IX_EFRating_EFClientStatHistoryStatHistoryId",
table: "EFRating",
column: "EFClientStatHistoryStatHistoryId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EFRating");
migrationBuilder.DropTable(
name: "EFClientAverageStatHistory");
migrationBuilder.DropTable(
name: "EFClientStatHistory");
migrationBuilder.DropColumn(
name: "AutomatedOffense",
table: "EFPenalties");
}
}
}

View File

@ -12,7 +12,7 @@ using System;
namespace SharedLibraryCore.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20180529233328_AddAutomatedOffenseAndRatingHistory")]
[Migration("20180531212903_AddAutomatedOffenseAndRatingHistory")]
partial class AddAutomatedOffenseAndRatingHistory
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -21,17 +21,6 @@ namespace SharedLibraryCore.Migrations
modelBuilder
.HasAnnotation("ProductVersion", "2.0.2-rtm-10011");
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientAverageStatHistory", b =>
{
b.Property<int>("ClientId");
b.Property<bool>("Active");
b.HasKey("ClientId");
b.ToTable("EFClientAverageStatHistory");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b =>
{
b.Property<long>("KillId")
@ -104,24 +93,20 @@ namespace SharedLibraryCore.Migrations
b.ToTable("EFClientMessages");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatHistory", b =>
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", b =>
{
b.Property<int>("StatHistoryId")
b.Property<int>("RatingHistoryId")
.ValueGeneratedOnAdd();
b.Property<bool>("Active");
b.Property<int>("ClientId");
b.Property<int>("ServerId");
b.HasKey("StatHistoryId");
b.HasKey("RatingHistoryId");
b.HasIndex("ClientId");
b.HasIndex("ServerId");
b.ToTable("EFClientStatHistory");
b.ToTable("EFClientRatingHistory");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b =>
@ -192,23 +177,21 @@ namespace SharedLibraryCore.Migrations
b.Property<bool>("Active");
b.Property<int>("ClientId");
b.Property<int?>("EFClientAverageStatHistoryClientId");
b.Property<int?>("EFClientStatHistoryStatHistoryId");
b.Property<bool>("Newest");
b.Property<double>("Performance");
b.Property<int>("Ranking");
b.Property<int>("RatingHistoryId");
b.Property<int?>("ServerId");
b.HasKey("RatingId");
b.HasIndex("ClientId");
b.HasIndex("RatingHistoryId");
b.HasIndex("EFClientAverageStatHistoryClientId");
b.HasIndex("EFClientStatHistoryStatHistoryId");
b.HasIndex("ServerId");
b.ToTable("EFRating");
});
@ -373,14 +356,6 @@ namespace SharedLibraryCore.Migrations
b.ToTable("Vector3");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientAverageStatHistory", b =>
{
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b =>
{
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Attacker")
@ -424,17 +399,12 @@ namespace SharedLibraryCore.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatHistory", b =>
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", b =>
{
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b =>
@ -470,18 +440,14 @@ namespace SharedLibraryCore.Migrations
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFRating", b =>
{
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", "RatingHistory")
.WithMany("Ratings")
.HasForeignKey("RatingHistoryId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientAverageStatHistory")
.WithMany("Ratings")
.HasForeignKey("EFClientAverageStatHistoryClientId");
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientStatHistory")
.WithMany("Ratings")
.HasForeignKey("EFClientStatHistoryStatHistoryId");
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>

View File

@ -0,0 +1,95 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace SharedLibraryCore.Migrations
{
public partial class AddAutomatedOffenseAndRatingHistory : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "AutomatedOffense",
table: "EFPenalties",
nullable: true);
migrationBuilder.CreateTable(
name: "EFClientRatingHistory",
columns: table => new
{
RatingHistoryId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFClientRatingHistory", x => x.RatingHistoryId);
table.ForeignKey(
name: "FK_EFClientRatingHistory_EFClients_ClientId",
column: x => x.ClientId,
principalTable: "EFClients",
principalColumn: "ClientId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EFRating",
columns: table => new
{
RatingId = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Active = table.Column<bool>(nullable: false),
Newest = table.Column<bool>(nullable: false),
Performance = table.Column<double>(nullable: false),
Ranking = table.Column<int>(nullable: false),
RatingHistoryId = table.Column<int>(nullable: false),
ServerId = table.Column<int>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EFRating", x => x.RatingId);
table.ForeignKey(
name: "FK_EFRating_EFClientRatingHistory_RatingHistoryId",
column: x => x.RatingHistoryId,
principalTable: "EFClientRatingHistory",
principalColumn: "RatingHistoryId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EFRating_EFServers_ServerId",
column: x => x.ServerId,
principalTable: "EFServers",
principalColumn: "ServerId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_EFClientRatingHistory_ClientId",
table: "EFClientRatingHistory",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_EFRating_RatingHistoryId",
table: "EFRating",
column: "RatingHistoryId");
migrationBuilder.CreateIndex(
name: "IX_EFRating_ServerId",
table: "EFRating",
column: "ServerId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EFRating");
migrationBuilder.DropTable(
name: "EFClientRatingHistory");
migrationBuilder.DropColumn(
name: "AutomatedOffense",
table: "EFPenalties");
}
}
}

View File

@ -20,17 +20,6 @@ namespace SharedLibraryCore.Migrations
modelBuilder
.HasAnnotation("ProductVersion", "2.0.2-rtm-10011");
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientAverageStatHistory", b =>
{
b.Property<int>("ClientId");
b.Property<bool>("Active");
b.HasKey("ClientId");
b.ToTable("EFClientAverageStatHistory");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b =>
{
b.Property<long>("KillId")
@ -103,24 +92,20 @@ namespace SharedLibraryCore.Migrations
b.ToTable("EFClientMessages");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatHistory", b =>
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", b =>
{
b.Property<int>("StatHistoryId")
b.Property<int>("RatingHistoryId")
.ValueGeneratedOnAdd();
b.Property<bool>("Active");
b.Property<int>("ClientId");
b.Property<int>("ServerId");
b.HasKey("StatHistoryId");
b.HasKey("RatingHistoryId");
b.HasIndex("ClientId");
b.HasIndex("ServerId");
b.ToTable("EFClientStatHistory");
b.ToTable("EFClientRatingHistory");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b =>
@ -191,23 +176,21 @@ namespace SharedLibraryCore.Migrations
b.Property<bool>("Active");
b.Property<int>("ClientId");
b.Property<int?>("EFClientAverageStatHistoryClientId");
b.Property<int?>("EFClientStatHistoryStatHistoryId");
b.Property<bool>("Newest");
b.Property<double>("Performance");
b.Property<int>("Ranking");
b.Property<int>("RatingHistoryId");
b.Property<int?>("ServerId");
b.HasKey("RatingId");
b.HasIndex("ClientId");
b.HasIndex("RatingHistoryId");
b.HasIndex("EFClientAverageStatHistoryClientId");
b.HasIndex("EFClientStatHistoryStatHistoryId");
b.HasIndex("ServerId");
b.ToTable("EFRating");
});
@ -372,14 +355,6 @@ namespace SharedLibraryCore.Migrations
b.ToTable("Vector3");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientAverageStatHistory", b =>
{
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b =>
{
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Attacker")
@ -423,17 +398,12 @@ namespace SharedLibraryCore.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatHistory", b =>
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", b =>
{
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b =>
@ -469,18 +439,14 @@ namespace SharedLibraryCore.Migrations
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFRating", b =>
{
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", "RatingHistory")
.WithMany("Ratings")
.HasForeignKey("RatingHistoryId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientAverageStatHistory")
.WithMany("Ratings")
.HasForeignKey("EFClientAverageStatHistoryClientId");
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientStatHistory")
.WithMany("Ratings")
.HasForeignKey("EFClientStatHistoryStatHistoryId");
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
});
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>