simplify ban process with new system

This commit is contained in:
RaidMax 2022-02-22 17:09:50 -06:00
parent d527a86911
commit 78ef977268
28 changed files with 11222 additions and 284 deletions

View File

@ -482,7 +482,7 @@ namespace IW4MAdmin
else if (E.Type == GameEvent.EventType.Unflag)
{
var unflagPenalty = new EFPenalty()
var unflagPenalty = new EFPenalty
{
Type = EFPenalty.PenaltyType.Unflag,
Expires = DateTime.UtcNow,
@ -494,7 +494,8 @@ namespace IW4MAdmin
};
E.Target.SetLevel(Permission.User, E.Origin);
await Manager.GetPenaltyService().RemoveActivePenalties(E.Target.AliasLinkId);
await Manager.GetPenaltyService().RemoveActivePenalties(E.Target.AliasLinkId, E.Target.NetworkId,
E.Target.CurrentAlias?.IPAddress);
await Manager.GetPenaltyService().Create(unflagPenalty);
}
@ -1444,7 +1445,6 @@ namespace IW4MAdmin
Offender = targetClient,
Offense = reason,
Punisher = originClient,
Link = targetClient.AliasLink,
IsEvadedOffense = isEvade
};
@ -1479,7 +1479,8 @@ namespace IW4MAdmin
ServerLogger.LogDebug("Creating unban penalty for {targetClient}", targetClient.ToString());
targetClient.SetLevel(Permission.User, originClient);
await Manager.GetPenaltyService().RemoveActivePenalties(targetClient.AliasLink.AliasLinkId);
await Manager.GetPenaltyService().RemoveActivePenalties(targetClient.AliasLink.AliasLinkId,
targetClient.NetworkId, targetClient.CurrentAlias?.IPAddress);
await Manager.GetPenaltyService().Create(unbanPenalty);
}

View File

@ -61,7 +61,7 @@ namespace IW4MAdmin.Application.Meta
iqIpLinkedPenalties = ctx.Penalties.AsNoTracking()
.Where(penalty =>
linkedPenaltyType.Contains(penalty.Type) && aliasedIds.Contains(penalty.LinkId));
linkedPenaltyType.Contains(penalty.Type) && aliasedIds.Contains(penalty.LinkId ?? -1));
}
var iqAllPenalties = iqPenalties;

View File

@ -18,6 +18,7 @@ namespace Data.Context
public DbSet<EFAlias> Aliases { get; set; }
public DbSet<EFAliasLink> AliasLinks { get; set; }
public DbSet<EFPenalty> Penalties { get; set; }
public DbSet<EFPenaltyIdentifier> PenaltyIdentifiers { get; set; }
public DbSet<EFMeta> EFMeta { get; set; }
public DbSet<EFChangeHistory> EFChangeHistory { get; set; }
@ -130,6 +131,12 @@ namespace Data.Context
.OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<EFPenaltyIdentifier>(ent =>
{
ent.HasIndex(identifiers => identifiers.NetworkId);
ent.HasIndex(identifiers => identifiers.IPv4Address);
});
modelBuilder.Entity<EFClientConnectionHistory>(ent => ent.HasIndex(history => history.CreatedDateTime));
// force full name for database conversion
@ -137,6 +144,7 @@ namespace Data.Context
modelBuilder.Entity<EFAlias>().ToTable("EFAlias");
modelBuilder.Entity<EFAliasLink>().ToTable("EFAliasLinks");
modelBuilder.Entity<EFPenalty>().ToTable("EFPenalties");
modelBuilder.Entity<EFPenaltyIdentifier>().ToTable("EFPenaltyIdentifiers");
modelBuilder.Entity<EFServerSnapshot>().ToTable(nameof(EFServerSnapshot));
modelBuilder.Entity<EFClientConnectionHistory>().ToTable(nameof(EFClientConnectionHistory));

View File

@ -24,7 +24,8 @@ namespace Data.MigrationContext
{
if (MigrationExtensions.IsMigration)
{
optionsBuilder.UseMySql(ServerVersion.AutoDetect("Server=127.0.0.1;Database=IW4MAdmin_Migration;Uid=root;Pwd=password;"))
var connectionString = "Server=127.0.0.1;Database=IW4MAdmin_Migration;Uid=root;Pwd=password;";
optionsBuilder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString))
.EnableDetailedErrors()
.EnableSensitiveDataLogging();
}

View File

@ -23,6 +23,7 @@ namespace Data.MigrationContext
{
if (MigrationExtensions.IsMigration)
{
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
optionsBuilder.UseNpgsql(
"Host=127.0.0.1;Database=IW4MAdmin_Migration;Username=postgres;Password=password;",
options => options.SetPostgresVersion(new Version("12.9")))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,250 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.MySql
{
public partial class AddEFPenaltyIdentifier : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "EFPenaltyIdentifiers",
columns: table => new
{
PenaltyIdentifierId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
IPv4Address = table.Column<int>(type: "int", nullable: true),
NetworkId = table.Column<long>(type: "bigint", nullable: false),
PenaltyId = table.Column<int>(type: "int", nullable: false),
Active = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFPenaltyIdentifiers", x => x.PenaltyIdentifierId);
table.ForeignKey(
name: "FK_EFPenaltyIdentifiers_EFPenalties_PenaltyId",
column: x => x.PenaltyId,
principalTable: "EFPenalties",
principalColumn: "PenaltyId",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_EFPenaltyIdentifiers_IPv4Address",
table: "EFPenaltyIdentifiers",
column: "IPv4Address");
migrationBuilder.CreateIndex(
name: "IX_EFPenaltyIdentifiers_NetworkId",
table: "EFPenaltyIdentifiers",
column: "NetworkId");
migrationBuilder.CreateIndex(
name: "IX_EFPenaltyIdentifiers_PenaltyId",
table: "EFPenaltyIdentifiers",
column: "PenaltyId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EFPenaltyIdentifiers");
migrationBuilder.AlterColumn<string>(
name: "Message",
table: "InboxMessages",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "EFWeaponAttachments",
type: "longtext CHARACTER SET utf8mb4",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "HostName",
table: "EFServers",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "EndPoint",
table: "EFServers",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Offense",
table: "EFPenalties",
type: "longtext CHARACTER SET utf8mb4",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "AutomatedOffense",
table: "EFPenalties",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Value",
table: "EFMeta",
type: "longtext CHARACTER SET utf8mb4",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Extra",
table: "EFMeta",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "EFMeansOfDeath",
type: "longtext CHARACTER SET utf8mb4",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "EFMaps",
type: "longtext CHARACTER SET utf8mb4",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "PasswordSalt",
table: "EFClients",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Password",
table: "EFClients",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Message",
table: "EFClientMessages",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "WeaponReference",
table: "EFClientKills",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "PreviousValue",
table: "EFChangeHistory",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "CurrentValue",
table: "EFChangeHistory",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "WeaponReference",
table: "EFACSnapshot",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "HitLocationReference",
table: "EFACSnapshot",
type: "longtext CHARACTER SET utf8mb4",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.MySql
{
public partial class MakeEFPenaltyLinkIdNullable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties");
migrationBuilder.AlterColumn<int>(
name: "LinkId",
table: "EFPenalties",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties",
column: "LinkId",
principalTable: "EFAliasLinks",
principalColumn: "AliasLinkId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties");
migrationBuilder.AlterColumn<int>(
name: "LinkId",
table: "EFPenalties",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties",
column: "LinkId",
principalTable: "EFAliasLinks",
principalColumn: "AliasLinkId",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Data.Migrations.MySql
{
[DbContext(typeof(MySqlDatabaseContext))]
@ -14,7 +16,7 @@ namespace Data.Migrations.MySql
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.10")
.HasAnnotation("ProductVersion", "6.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Data.Models.Client.EFACSnapshotVector3", b =>
@ -38,7 +40,7 @@ namespace Data.Migrations.MySql
b.HasIndex("Vector3Id");
b.ToTable("EFACSnapshotVector3");
b.ToTable("EFACSnapshotVector3", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClient", b =>
@ -75,10 +77,10 @@ namespace Data.Migrations.MySql
.HasColumnType("bigint");
b.Property<string>("Password")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<string>("PasswordSalt")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<int>("TotalConnectionTime")
.HasColumnType("int");
@ -92,7 +94,7 @@ namespace Data.Migrations.MySql
b.HasIndex("NetworkId")
.IsUnique();
b.ToTable("EFClients");
b.ToTable("EFClients", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClientConnectionHistory", b =>
@ -124,7 +126,7 @@ namespace Data.Migrations.MySql
b.HasIndex("ServerId");
b.ToTable("EFClientConnectionHistory");
b.ToTable("EFClientConnectionHistory", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClientKill", b =>
@ -179,7 +181,7 @@ namespace Data.Migrations.MySql
.HasColumnType("int");
b.Property<string>("WeaponReference")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<DateTime>("When")
.HasColumnType("datetime(6)");
@ -198,7 +200,7 @@ namespace Data.Migrations.MySql
b.HasIndex("ViewAnglesVector3Id");
b.ToTable("EFClientKills");
b.ToTable("EFClientKills", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClientMessage", b =>
@ -214,7 +216,7 @@ namespace Data.Migrations.MySql
.HasColumnType("int");
b.Property<string>("Message")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<bool>("SentIngame")
.HasColumnType("tinyint(1)");
@ -233,7 +235,7 @@ namespace Data.Migrations.MySql
b.HasIndex("TimeSent");
b.ToTable("EFClientMessages");
b.ToTable("EFClientMessages", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFACSnapshot", b =>
@ -273,7 +275,7 @@ namespace Data.Migrations.MySql
.HasColumnType("int");
b.Property<string>("HitLocationReference")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<int>("HitOriginId")
.HasColumnType("int");
@ -321,7 +323,7 @@ namespace Data.Migrations.MySql
.HasColumnType("int");
b.Property<string>("WeaponReference")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<DateTime>("When")
.HasColumnType("datetime(6)");
@ -340,7 +342,7 @@ namespace Data.Migrations.MySql
b.HasIndex("ServerId");
b.ToTable("EFACSnapshot");
b.ToTable("EFACSnapshot", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientHitStatistic", b =>
@ -414,7 +416,7 @@ namespace Data.Migrations.MySql
b.HasIndex("WeaponId");
b.ToTable("EFClientHitStatistics");
b.ToTable("EFClientHitStatistics", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRankingHistory", b =>
@ -459,7 +461,7 @@ namespace Data.Migrations.MySql
b.HasIndex("ZScore");
b.ToTable("EFClientRankingHistory");
b.ToTable("EFClientRankingHistory", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRatingHistory", b =>
@ -478,7 +480,7 @@ namespace Data.Migrations.MySql
b.HasIndex("ClientId");
b.ToTable("EFClientRatingHistory");
b.ToTable("EFClientRatingHistory", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientStatistics", b =>
@ -536,7 +538,7 @@ namespace Data.Migrations.MySql
b.HasIndex("ClientId", "TimePlayed", "ZScore");
b.ToTable("EFClientStatistics");
b.ToTable("EFClientStatistics", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFHitLocationCount", b =>
@ -549,12 +551,12 @@ namespace Data.Migrations.MySql
.HasColumnType("tinyint(1)");
b.Property<int>("EFClientStatisticsClientId")
.HasColumnName("EFClientStatisticsClientId")
.HasColumnType("int");
.HasColumnType("int")
.HasColumnName("EFClientStatisticsClientId");
b.Property<long>("EFClientStatisticsServerId")
.HasColumnName("EFClientStatisticsServerId")
.HasColumnType("bigint");
.HasColumnType("bigint")
.HasColumnName("EFClientStatisticsServerId");
b.Property<int>("HitCount")
.HasColumnType("int");
@ -574,7 +576,7 @@ namespace Data.Migrations.MySql
b.HasIndex("EFClientStatisticsClientId", "EFClientStatisticsServerId");
b.ToTable("EFHitLocationCounts");
b.ToTable("EFHitLocationCounts", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFRating", b =>
@ -617,7 +619,7 @@ namespace Data.Migrations.MySql
b.HasIndex("When", "ServerId", "Performance", "ActivityAmount");
b.ToTable("EFRating");
b.ToTable("EFRating", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFHitLocation", b =>
@ -634,7 +636,7 @@ namespace Data.Migrations.MySql
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(255) CHARACTER SET utf8mb4");
.HasColumnType("varchar(255)");
b.Property<DateTime?>("UpdatedDateTime")
.HasColumnType("datetime(6)");
@ -643,7 +645,7 @@ namespace Data.Migrations.MySql
b.HasIndex("Name");
b.ToTable("EFHitLocations");
b.ToTable("EFHitLocations", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFMap", b =>
@ -660,14 +662,14 @@ namespace Data.Migrations.MySql
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<DateTime?>("UpdatedDateTime")
.HasColumnType("datetime(6)");
b.HasKey("MapId");
b.ToTable("EFMaps");
b.ToTable("EFMaps", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFMeansOfDeath", b =>
@ -684,14 +686,14 @@ namespace Data.Migrations.MySql
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<DateTime?>("UpdatedDateTime")
.HasColumnType("datetime(6)");
b.HasKey("MeansOfDeathId");
b.ToTable("EFMeansOfDeath");
b.ToTable("EFMeansOfDeath", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeapon", b =>
@ -708,7 +710,7 @@ namespace Data.Migrations.MySql
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(255) CHARACTER SET utf8mb4");
.HasColumnType("varchar(255)");
b.Property<DateTime?>("UpdatedDateTime")
.HasColumnType("datetime(6)");
@ -717,7 +719,7 @@ namespace Data.Migrations.MySql
b.HasIndex("Name");
b.ToTable("EFWeapons");
b.ToTable("EFWeapons", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeaponAttachment", b =>
@ -734,14 +736,14 @@ namespace Data.Migrations.MySql
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<DateTime?>("UpdatedDateTime")
.HasColumnType("datetime(6)");
b.HasKey("WeaponAttachmentId");
b.ToTable("EFWeaponAttachments");
b.ToTable("EFWeaponAttachments", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeaponAttachmentCombo", b =>
@ -776,7 +778,7 @@ namespace Data.Migrations.MySql
b.HasIndex("Attachment3Id");
b.ToTable("EFWeaponAttachmentCombos");
b.ToTable("EFWeaponAttachmentCombos", (string)null);
});
modelBuilder.Entity("Data.Models.EFAlias", b =>
@ -799,12 +801,12 @@ namespace Data.Migrations.MySql
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(24) CHARACTER SET utf8mb4")
.HasMaxLength(24);
.HasMaxLength(24)
.HasColumnType("varchar(24)");
b.Property<string>("SearchableName")
.HasColumnType("varchar(24) CHARACTER SET utf8mb4")
.HasMaxLength(24);
.HasMaxLength(24)
.HasColumnType("varchar(24)");
b.HasKey("AliasId");
@ -818,7 +820,7 @@ namespace Data.Migrations.MySql
b.HasIndex("Name", "IPAddress");
b.ToTable("EFAlias");
b.ToTable("EFAlias", (string)null);
});
modelBuilder.Entity("Data.Models.EFAliasLink", b =>
@ -832,7 +834,7 @@ namespace Data.Migrations.MySql
b.HasKey("AliasLinkId");
b.ToTable("EFAliasLinks");
b.ToTable("EFAliasLinks", (string)null);
});
modelBuilder.Entity("Data.Models.EFChangeHistory", b =>
@ -845,11 +847,11 @@ namespace Data.Migrations.MySql
.HasColumnType("tinyint(1)");
b.Property<string>("Comment")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("CurrentValue")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<int?>("ImpersonationEntityId")
.HasColumnType("int");
@ -858,7 +860,7 @@ namespace Data.Migrations.MySql
.HasColumnType("int");
b.Property<string>("PreviousValue")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<int>("TargetEntityId")
.HasColumnType("int");
@ -890,12 +892,12 @@ namespace Data.Migrations.MySql
.HasColumnType("datetime(6)");
b.Property<string>("Extra")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("varchar(32) CHARACTER SET utf8mb4")
.HasMaxLength(32);
.HasMaxLength(32)
.HasColumnType("varchar(32)");
b.Property<int?>("LinkedMetaId")
.HasColumnType("int");
@ -905,7 +907,7 @@ namespace Data.Migrations.MySql
b.Property<string>("Value")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.HasKey("MetaId");
@ -928,7 +930,7 @@ namespace Data.Migrations.MySql
.HasColumnType("tinyint(1)");
b.Property<string>("AutomatedOffense")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<DateTime?>("Expires")
.HasColumnType("datetime(6)");
@ -936,7 +938,7 @@ namespace Data.Migrations.MySql
b.Property<bool>("IsEvadedOffense")
.HasColumnType("tinyint(1)");
b.Property<int>("LinkId")
b.Property<int?>("LinkId")
.HasColumnType("int");
b.Property<int>("OffenderId")
@ -944,7 +946,7 @@ namespace Data.Migrations.MySql
b.Property<string>("Offense")
.IsRequired()
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<int>("PunisherId")
.HasColumnType("int");
@ -963,7 +965,36 @@ namespace Data.Migrations.MySql
b.HasIndex("PunisherId");
b.ToTable("EFPenalties");
b.ToTable("EFPenalties", (string)null);
});
modelBuilder.Entity("Data.Models.EFPenaltyIdentifier", b =>
{
b.Property<int>("PenaltyIdentifierId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<bool>("Active")
.HasColumnType("tinyint(1)");
b.Property<int?>("IPv4Address")
.HasColumnType("int");
b.Property<long>("NetworkId")
.HasColumnType("bigint");
b.Property<int>("PenaltyId")
.HasColumnType("int");
b.HasKey("PenaltyIdentifierId");
b.HasIndex("IPv4Address");
b.HasIndex("NetworkId");
b.HasIndex("PenaltyId");
b.ToTable("EFPenaltyIdentifiers", (string)null);
});
modelBuilder.Entity("Data.Models.Misc.EFInboxMessage", b =>
@ -982,7 +1013,7 @@ namespace Data.Migrations.MySql
.HasColumnType("tinyint(1)");
b.Property<string>("Message")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<long?>("ServerId")
.HasColumnType("bigint");
@ -1013,13 +1044,13 @@ namespace Data.Migrations.MySql
.HasColumnType("tinyint(1)");
b.Property<string>("EndPoint")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<int?>("GameName")
.HasColumnType("int");
b.Property<string>("HostName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
.HasColumnType("longtext");
b.Property<bool>("IsPasswordProtected")
.HasColumnType("tinyint(1)");
@ -1029,7 +1060,7 @@ namespace Data.Migrations.MySql
b.HasKey("ServerId");
b.ToTable("EFServers");
b.ToTable("EFServers", (string)null);
});
modelBuilder.Entity("Data.Models.Server.EFServerSnapshot", b =>
@ -1062,7 +1093,7 @@ namespace Data.Migrations.MySql
b.HasIndex("ServerId");
b.ToTable("EFServerSnapshot");
b.ToTable("EFServerSnapshot", (string)null);
});
modelBuilder.Entity("Data.Models.Server.EFServerStatistics", b =>
@ -1087,7 +1118,7 @@ namespace Data.Migrations.MySql
b.HasIndex("ServerId");
b.ToTable("EFServerStatistics");
b.ToTable("EFServerStatistics", (string)null);
});
modelBuilder.Entity("Data.Models.Vector3", b =>
@ -1107,7 +1138,7 @@ namespace Data.Migrations.MySql
b.HasKey("Vector3Id");
b.ToTable("Vector3");
b.ToTable("Vector3", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFACSnapshotVector3", b =>
@ -1123,6 +1154,10 @@ namespace Data.Migrations.MySql
.HasForeignKey("Vector3Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Snapshot");
b.Navigation("Vector");
});
modelBuilder.Entity("Data.Models.Client.EFClient", b =>
@ -1138,6 +1173,10 @@ namespace Data.Migrations.MySql
.HasForeignKey("CurrentAliasId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AliasLink");
b.Navigation("CurrentAlias");
});
modelBuilder.Entity("Data.Models.Client.EFClientConnectionHistory", b =>
@ -1153,6 +1192,10 @@ namespace Data.Migrations.MySql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.EFClientKill", b =>
@ -1186,6 +1229,18 @@ namespace Data.Migrations.MySql
b.HasOne("Data.Models.Vector3", "ViewAngles")
.WithMany()
.HasForeignKey("ViewAnglesVector3Id");
b.Navigation("Attacker");
b.Navigation("DeathOrigin");
b.Navigation("KillOrigin");
b.Navigation("Server");
b.Navigation("Victim");
b.Navigation("ViewAngles");
});
modelBuilder.Entity("Data.Models.Client.EFClientMessage", b =>
@ -1201,6 +1256,10 @@ namespace Data.Migrations.MySql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFACSnapshot", b =>
@ -1238,6 +1297,18 @@ namespace Data.Migrations.MySql
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
b.Navigation("Client");
b.Navigation("CurrentViewAngle");
b.Navigation("HitDestination");
b.Navigation("HitOrigin");
b.Navigation("LastStrainAngle");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientHitStatistic", b =>
@ -1267,6 +1338,18 @@ namespace Data.Migrations.MySql
b.HasOne("Data.Models.Client.Stats.Reference.EFWeapon", "Weapon")
.WithMany()
.HasForeignKey("WeaponId");
b.Navigation("Client");
b.Navigation("HitLocation");
b.Navigation("MeansOfDeath");
b.Navigation("Server");
b.Navigation("Weapon");
b.Navigation("WeaponAttachmentCombo");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRankingHistory", b =>
@ -1280,6 +1363,10 @@ namespace Data.Migrations.MySql
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRatingHistory", b =>
@ -1289,6 +1376,8 @@ namespace Data.Migrations.MySql
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientStatistics", b =>
@ -1304,6 +1393,10 @@ namespace Data.Migrations.MySql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFHitLocationCount", b =>
@ -1325,6 +1418,10 @@ namespace Data.Migrations.MySql
.HasForeignKey("EFClientStatisticsClientId", "EFClientStatisticsServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFRating", b =>
@ -1338,6 +1435,10 @@ namespace Data.Migrations.MySql
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
b.Navigation("RatingHistory");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeaponAttachmentCombo", b =>
@ -1355,6 +1456,12 @@ namespace Data.Migrations.MySql
b.HasOne("Data.Models.Client.Stats.Reference.EFWeaponAttachment", "Attachment3")
.WithMany()
.HasForeignKey("Attachment3Id");
b.Navigation("Attachment1");
b.Navigation("Attachment2");
b.Navigation("Attachment3");
});
modelBuilder.Entity("Data.Models.EFAlias", b =>
@ -1364,6 +1471,8 @@ namespace Data.Migrations.MySql
.HasForeignKey("LinkId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Link");
});
modelBuilder.Entity("Data.Models.EFMeta", b =>
@ -1376,15 +1485,17 @@ namespace Data.Migrations.MySql
.WithMany()
.HasForeignKey("LinkedMetaId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Client");
b.Navigation("LinkedMeta");
});
modelBuilder.Entity("Data.Models.EFPenalty", b =>
{
b.HasOne("Data.Models.EFAliasLink", "Link")
.WithMany("ReceivedPenalties")
.HasForeignKey("LinkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("LinkId");
b.HasOne("Data.Models.Client.EFClient", "Offender")
.WithMany("ReceivedPenalties")
@ -1397,6 +1508,23 @@ namespace Data.Migrations.MySql
.HasForeignKey("PunisherId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Link");
b.Navigation("Offender");
b.Navigation("Punisher");
});
modelBuilder.Entity("Data.Models.EFPenaltyIdentifier", b =>
{
b.HasOne("Data.Models.EFPenalty", "Penalty")
.WithMany()
.HasForeignKey("PenaltyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Penalty");
});
modelBuilder.Entity("Data.Models.Misc.EFInboxMessage", b =>
@ -1416,6 +1544,12 @@ namespace Data.Migrations.MySql
.HasForeignKey("SourceClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DestinationClient");
b.Navigation("Server");
b.Navigation("SourceClient");
});
modelBuilder.Entity("Data.Models.Server.EFServerSnapshot", b =>
@ -1431,6 +1565,10 @@ namespace Data.Migrations.MySql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Map");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Server.EFServerStatistics", b =>
@ -1440,6 +1578,39 @@ namespace Data.Migrations.MySql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.EFClient", b =>
{
b.Navigation("AdministeredPenalties");
b.Navigation("Meta");
b.Navigation("ReceivedPenalties");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFACSnapshot", b =>
{
b.Navigation("PredictedViewAngles");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRatingHistory", b =>
{
b.Navigation("Ratings");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientStatistics", b =>
{
b.Navigation("HitLocations");
});
modelBuilder.Entity("Data.Models.EFAliasLink", b =>
{
b.Navigation("Children");
b.Navigation("ReceivedPenalties");
});
#pragma warning restore 612, 618
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Data.Migrations.Postgresql
{
public partial class AddEFPenaltyIdentifier : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "EFPenaltyIdentifiers",
columns: table => new
{
PenaltyIdentifierId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
IPv4Address = table.Column<int>(type: "integer", nullable: true),
NetworkId = table.Column<long>(type: "bigint", nullable: false),
PenaltyId = table.Column<int>(type: "integer", nullable: false),
Active = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFPenaltyIdentifiers", x => x.PenaltyIdentifierId);
table.ForeignKey(
name: "FK_EFPenaltyIdentifiers_EFPenalties_PenaltyId",
column: x => x.PenaltyId,
principalTable: "EFPenalties",
principalColumn: "PenaltyId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_EFPenaltyIdentifiers_IPv4Address",
table: "EFPenaltyIdentifiers",
column: "IPv4Address");
migrationBuilder.CreateIndex(
name: "IX_EFPenaltyIdentifiers_NetworkId",
table: "EFPenaltyIdentifiers",
column: "NetworkId");
migrationBuilder.CreateIndex(
name: "IX_EFPenaltyIdentifiers_PenaltyId",
table: "EFPenaltyIdentifiers",
column: "PenaltyId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EFPenaltyIdentifiers");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.Postgresql
{
public partial class MakeEFPenaltyLinkIdNullable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties");
migrationBuilder.AlterColumn<int>(
name: "LinkId",
table: "EFPenalties",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AddForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties",
column: "LinkId",
principalTable: "EFAliasLinks",
principalColumn: "AliasLinkId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties");
migrationBuilder.AlterColumn<int>(
name: "LinkId",
table: "EFPenalties",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties",
column: "LinkId",
principalTable: "EFAliasLinks",
principalColumn: "AliasLinkId",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Data.Migrations.Postgresql
{
[DbContext(typeof(PostgresqlDatabaseContext))]
@ -15,16 +17,18 @@ namespace Data.Migrations.Postgresql
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "3.1.10")
.HasAnnotation("ProductVersion", "6.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Data.Models.Client.EFACSnapshotVector3", b =>
{
b.Property<int>("ACSnapshotVector3Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ACSnapshotVector3Id"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -41,15 +45,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("Vector3Id");
b.ToTable("EFACSnapshotVector3");
b.ToTable("EFACSnapshotVector3", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClient", b =>
{
b.Property<int>("ClientId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ClientId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -96,15 +101,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("NetworkId")
.IsUnique();
b.ToTable("EFClients");
b.ToTable("EFClients", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClientConnectionHistory", b =>
{
b.Property<long>("ClientConnectionId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("ClientConnectionId"));
b.Property<int>("ClientId")
.HasColumnType("integer");
@ -129,15 +135,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("ServerId");
b.ToTable("EFClientConnectionHistory");
b.ToTable("EFClientConnectionHistory", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClientKill", b =>
{
b.Property<long>("KillId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("KillId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -204,15 +211,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("ViewAnglesVector3Id");
b.ToTable("EFClientKills");
b.ToTable("EFClientKills", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClientMessage", b =>
{
b.Property<long>("MessageId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("MessageId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -240,15 +248,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("TimeSent");
b.ToTable("EFClientMessages");
b.ToTable("EFClientMessages", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFACSnapshot", b =>
{
b.Property<int>("SnapshotId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SnapshotId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -348,15 +357,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("ServerId");
b.ToTable("EFACSnapshot");
b.ToTable("EFACSnapshot", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientHitStatistic", b =>
{
b.Property<int>("ClientHitStatisticId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ClientHitStatisticId"));
b.Property<int>("ClientId")
.HasColumnType("integer");
@ -423,15 +433,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("WeaponId");
b.ToTable("EFClientHitStatistics");
b.ToTable("EFClientHitStatistics", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRankingHistory", b =>
{
b.Property<long>("ClientRankingHistoryId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("ClientRankingHistoryId"));
b.Property<int>("ClientId")
.HasColumnType("integer");
@ -469,15 +480,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("ZScore");
b.ToTable("EFClientRankingHistory");
b.ToTable("EFClientRankingHistory", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRatingHistory", b =>
{
b.Property<int>("RatingHistoryId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RatingHistoryId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -489,7 +501,7 @@ namespace Data.Migrations.Postgresql
b.HasIndex("ClientId");
b.ToTable("EFClientRatingHistory");
b.ToTable("EFClientRatingHistory", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientStatistics", b =>
@ -547,26 +559,27 @@ namespace Data.Migrations.Postgresql
b.HasIndex("ClientId", "TimePlayed", "ZScore");
b.ToTable("EFClientStatistics");
b.ToTable("EFClientStatistics", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFHitLocationCount", b =>
{
b.Property<int>("HitLocationCountId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("HitLocationCountId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
b.Property<int>("EFClientStatisticsClientId")
.HasColumnName("EFClientStatisticsClientId")
.HasColumnType("integer");
.HasColumnType("integer")
.HasColumnName("EFClientStatisticsClientId");
b.Property<long>("EFClientStatisticsServerId")
.HasColumnName("EFClientStatisticsServerId")
.HasColumnType("bigint");
.HasColumnType("bigint")
.HasColumnName("EFClientStatisticsServerId");
b.Property<int>("HitCount")
.HasColumnType("integer");
@ -586,15 +599,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("EFClientStatisticsClientId", "EFClientStatisticsServerId");
b.ToTable("EFHitLocationCounts");
b.ToTable("EFHitLocationCounts", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFRating", b =>
{
b.Property<int>("RatingId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RatingId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -630,15 +644,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("When", "ServerId", "Performance", "ActivityAmount");
b.ToTable("EFRating");
b.ToTable("EFRating", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFHitLocation", b =>
{
b.Property<int>("HitLocationId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("HitLocationId"));
b.Property<DateTime>("CreatedDateTime")
.HasColumnType("timestamp without time zone");
@ -657,15 +672,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("Name");
b.ToTable("EFHitLocations");
b.ToTable("EFHitLocations", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFMap", b =>
{
b.Property<int>("MapId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("MapId"));
b.Property<DateTime>("CreatedDateTime")
.HasColumnType("timestamp without time zone");
@ -682,15 +698,16 @@ namespace Data.Migrations.Postgresql
b.HasKey("MapId");
b.ToTable("EFMaps");
b.ToTable("EFMaps", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFMeansOfDeath", b =>
{
b.Property<int>("MeansOfDeathId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("MeansOfDeathId"));
b.Property<DateTime>("CreatedDateTime")
.HasColumnType("timestamp without time zone");
@ -707,15 +724,16 @@ namespace Data.Migrations.Postgresql
b.HasKey("MeansOfDeathId");
b.ToTable("EFMeansOfDeath");
b.ToTable("EFMeansOfDeath", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeapon", b =>
{
b.Property<int>("WeaponId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("WeaponId"));
b.Property<DateTime>("CreatedDateTime")
.HasColumnType("timestamp without time zone");
@ -734,15 +752,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("Name");
b.ToTable("EFWeapons");
b.ToTable("EFWeapons", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeaponAttachment", b =>
{
b.Property<int>("WeaponAttachmentId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("WeaponAttachmentId"));
b.Property<DateTime>("CreatedDateTime")
.HasColumnType("timestamp without time zone");
@ -759,15 +778,16 @@ namespace Data.Migrations.Postgresql
b.HasKey("WeaponAttachmentId");
b.ToTable("EFWeaponAttachments");
b.ToTable("EFWeaponAttachments", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeaponAttachmentCombo", b =>
{
b.Property<int>("WeaponAttachmentComboId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("WeaponAttachmentComboId"));
b.Property<int>("Attachment1Id")
.HasColumnType("integer");
@ -795,15 +815,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("Attachment3Id");
b.ToTable("EFWeaponAttachmentCombos");
b.ToTable("EFWeaponAttachmentCombos", (string)null);
});
modelBuilder.Entity("Data.Models.EFAlias", b =>
{
b.Property<int>("AliasId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("AliasId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -819,12 +840,12 @@ namespace Data.Migrations.Postgresql
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(24)")
.HasMaxLength(24);
.HasMaxLength(24)
.HasColumnType("character varying(24)");
b.Property<string>("SearchableName")
.HasColumnType("character varying(24)")
.HasMaxLength(24);
.HasMaxLength(24)
.HasColumnType("character varying(24)");
b.HasKey("AliasId");
@ -838,37 +859,39 @@ namespace Data.Migrations.Postgresql
b.HasIndex("Name", "IPAddress");
b.ToTable("EFAlias");
b.ToTable("EFAlias", (string)null);
});
modelBuilder.Entity("Data.Models.EFAliasLink", b =>
{
b.Property<int>("AliasLinkId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("AliasLinkId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
b.HasKey("AliasLinkId");
b.ToTable("EFAliasLinks");
b.ToTable("EFAliasLinks", (string)null);
});
modelBuilder.Entity("Data.Models.EFChangeHistory", b =>
{
b.Property<int>("ChangeHistoryId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ChangeHistoryId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
b.Property<string>("Comment")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<string>("CurrentValue")
.HasColumnType("text");
@ -900,8 +923,9 @@ namespace Data.Migrations.Postgresql
{
b.Property<int>("MetaId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("MetaId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -917,8 +941,8 @@ namespace Data.Migrations.Postgresql
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(32)")
.HasMaxLength(32);
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property<int?>("LinkedMetaId")
.HasColumnType("integer");
@ -945,8 +969,9 @@ namespace Data.Migrations.Postgresql
{
b.Property<int>("PenaltyId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PenaltyId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -960,7 +985,7 @@ namespace Data.Migrations.Postgresql
b.Property<bool>("IsEvadedOffense")
.HasColumnType("boolean");
b.Property<int>("LinkId")
b.Property<int?>("LinkId")
.HasColumnType("integer");
b.Property<int>("OffenderId")
@ -987,15 +1012,47 @@ namespace Data.Migrations.Postgresql
b.HasIndex("PunisherId");
b.ToTable("EFPenalties");
b.ToTable("EFPenalties", (string)null);
});
modelBuilder.Entity("Data.Models.EFPenaltyIdentifier", b =>
{
b.Property<int>("PenaltyIdentifierId")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PenaltyIdentifierId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
b.Property<int?>("IPv4Address")
.HasColumnType("integer");
b.Property<long>("NetworkId")
.HasColumnType("bigint");
b.Property<int>("PenaltyId")
.HasColumnType("integer");
b.HasKey("PenaltyIdentifierId");
b.HasIndex("IPv4Address");
b.HasIndex("NetworkId");
b.HasIndex("PenaltyId");
b.ToTable("EFPenaltyIdentifiers", (string)null);
});
modelBuilder.Entity("Data.Models.Misc.EFInboxMessage", b =>
{
b.Property<int>("InboxMessageId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("InboxMessageId"));
b.Property<DateTime>("CreatedDateTime")
.HasColumnType("timestamp without time zone");
@ -1054,15 +1111,16 @@ namespace Data.Migrations.Postgresql
b.HasKey("ServerId");
b.ToTable("EFServers");
b.ToTable("EFServers", (string)null);
});
modelBuilder.Entity("Data.Models.Server.EFServerSnapshot", b =>
{
b.Property<long>("ServerSnapshotId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("ServerSnapshotId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -1088,15 +1146,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("ServerId");
b.ToTable("EFServerSnapshot");
b.ToTable("EFServerSnapshot", (string)null);
});
modelBuilder.Entity("Data.Models.Server.EFServerStatistics", b =>
{
b.Property<int>("StatisticId")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("StatisticId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
@ -1114,15 +1173,16 @@ namespace Data.Migrations.Postgresql
b.HasIndex("ServerId");
b.ToTable("EFServerStatistics");
b.ToTable("EFServerStatistics", (string)null);
});
modelBuilder.Entity("Data.Models.Vector3", b =>
{
b.Property<int>("Vector3Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Vector3Id"));
b.Property<float>("X")
.HasColumnType("real");
@ -1135,7 +1195,7 @@ namespace Data.Migrations.Postgresql
b.HasKey("Vector3Id");
b.ToTable("Vector3");
b.ToTable("Vector3", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFACSnapshotVector3", b =>
@ -1151,6 +1211,10 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("Vector3Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Snapshot");
b.Navigation("Vector");
});
modelBuilder.Entity("Data.Models.Client.EFClient", b =>
@ -1166,6 +1230,10 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("CurrentAliasId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AliasLink");
b.Navigation("CurrentAlias");
});
modelBuilder.Entity("Data.Models.Client.EFClientConnectionHistory", b =>
@ -1181,6 +1249,10 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.EFClientKill", b =>
@ -1214,6 +1286,18 @@ namespace Data.Migrations.Postgresql
b.HasOne("Data.Models.Vector3", "ViewAngles")
.WithMany()
.HasForeignKey("ViewAnglesVector3Id");
b.Navigation("Attacker");
b.Navigation("DeathOrigin");
b.Navigation("KillOrigin");
b.Navigation("Server");
b.Navigation("Victim");
b.Navigation("ViewAngles");
});
modelBuilder.Entity("Data.Models.Client.EFClientMessage", b =>
@ -1229,6 +1313,10 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFACSnapshot", b =>
@ -1266,6 +1354,18 @@ namespace Data.Migrations.Postgresql
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
b.Navigation("Client");
b.Navigation("CurrentViewAngle");
b.Navigation("HitDestination");
b.Navigation("HitOrigin");
b.Navigation("LastStrainAngle");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientHitStatistic", b =>
@ -1295,6 +1395,18 @@ namespace Data.Migrations.Postgresql
b.HasOne("Data.Models.Client.Stats.Reference.EFWeapon", "Weapon")
.WithMany()
.HasForeignKey("WeaponId");
b.Navigation("Client");
b.Navigation("HitLocation");
b.Navigation("MeansOfDeath");
b.Navigation("Server");
b.Navigation("Weapon");
b.Navigation("WeaponAttachmentCombo");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRankingHistory", b =>
@ -1308,6 +1420,10 @@ namespace Data.Migrations.Postgresql
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRatingHistory", b =>
@ -1317,6 +1433,8 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientStatistics", b =>
@ -1332,6 +1450,10 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFHitLocationCount", b =>
@ -1353,6 +1475,10 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("EFClientStatisticsClientId", "EFClientStatisticsServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFRating", b =>
@ -1366,6 +1492,10 @@ namespace Data.Migrations.Postgresql
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
b.Navigation("RatingHistory");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeaponAttachmentCombo", b =>
@ -1383,6 +1513,12 @@ namespace Data.Migrations.Postgresql
b.HasOne("Data.Models.Client.Stats.Reference.EFWeaponAttachment", "Attachment3")
.WithMany()
.HasForeignKey("Attachment3Id");
b.Navigation("Attachment1");
b.Navigation("Attachment2");
b.Navigation("Attachment3");
});
modelBuilder.Entity("Data.Models.EFAlias", b =>
@ -1392,6 +1528,8 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("LinkId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Link");
});
modelBuilder.Entity("Data.Models.EFMeta", b =>
@ -1404,15 +1542,17 @@ namespace Data.Migrations.Postgresql
.WithMany()
.HasForeignKey("LinkedMetaId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Client");
b.Navigation("LinkedMeta");
});
modelBuilder.Entity("Data.Models.EFPenalty", b =>
{
b.HasOne("Data.Models.EFAliasLink", "Link")
.WithMany("ReceivedPenalties")
.HasForeignKey("LinkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("LinkId");
b.HasOne("Data.Models.Client.EFClient", "Offender")
.WithMany("ReceivedPenalties")
@ -1425,6 +1565,23 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("PunisherId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Link");
b.Navigation("Offender");
b.Navigation("Punisher");
});
modelBuilder.Entity("Data.Models.EFPenaltyIdentifier", b =>
{
b.HasOne("Data.Models.EFPenalty", "Penalty")
.WithMany()
.HasForeignKey("PenaltyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Penalty");
});
modelBuilder.Entity("Data.Models.Misc.EFInboxMessage", b =>
@ -1444,6 +1601,12 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("SourceClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DestinationClient");
b.Navigation("Server");
b.Navigation("SourceClient");
});
modelBuilder.Entity("Data.Models.Server.EFServerSnapshot", b =>
@ -1459,6 +1622,10 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Map");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Server.EFServerStatistics", b =>
@ -1468,6 +1635,39 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.EFClient", b =>
{
b.Navigation("AdministeredPenalties");
b.Navigation("Meta");
b.Navigation("ReceivedPenalties");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFACSnapshot", b =>
{
b.Navigation("PredictedViewAngles");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRatingHistory", b =>
{
b.Navigation("Ratings");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientStatistics", b =>
{
b.Navigation("HitLocations");
});
modelBuilder.Entity("Data.Models.EFAliasLink", b =>
{
b.Navigation("Children");
b.Navigation("ReceivedPenalties");
});
#pragma warning restore 612, 618
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.Sqlite
{
public partial class AddEFPenaltyIdentifier : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "EFPenaltyIdentifiers",
columns: table => new
{
PenaltyIdentifierId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
IPv4Address = table.Column<int>(type: "INTEGER", nullable: true),
NetworkId = table.Column<long>(type: "INTEGER", nullable: false),
PenaltyId = table.Column<int>(type: "INTEGER", nullable: false),
Active = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFPenaltyIdentifiers", x => x.PenaltyIdentifierId);
table.ForeignKey(
name: "FK_EFPenaltyIdentifiers_EFPenalties_PenaltyId",
column: x => x.PenaltyId,
principalTable: "EFPenalties",
principalColumn: "PenaltyId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_EFPenaltyIdentifiers_IPv4Address",
table: "EFPenaltyIdentifiers",
column: "IPv4Address");
migrationBuilder.CreateIndex(
name: "IX_EFPenaltyIdentifiers_NetworkId",
table: "EFPenaltyIdentifiers",
column: "NetworkId");
migrationBuilder.CreateIndex(
name: "IX_EFPenaltyIdentifiers_PenaltyId",
table: "EFPenaltyIdentifiers",
column: "PenaltyId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EFPenaltyIdentifiers");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.Sqlite
{
public partial class MakeEFPenaltyLinkIdNullable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties");
migrationBuilder.AlterColumn<int>(
name: "LinkId",
table: "EFPenalties",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AddForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties",
column: "LinkId",
principalTable: "EFAliasLinks",
principalColumn: "AliasLinkId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties");
migrationBuilder.AlterColumn<int>(
name: "LinkId",
table: "EFPenalties",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_EFPenalties_EFAliasLinks_LinkId",
table: "EFPenalties",
column: "LinkId",
principalTable: "EFAliasLinks",
principalColumn: "AliasLinkId",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Data.Migrations.Sqlite
{
[DbContext(typeof(SqliteDatabaseContext))]
@ -13,8 +15,7 @@ namespace Data.Migrations.Sqlite
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.10");
modelBuilder.HasAnnotation("ProductVersion", "6.0.1");
modelBuilder.Entity("Data.Models.Client.EFACSnapshotVector3", b =>
{
@ -37,7 +38,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("Vector3Id");
b.ToTable("EFACSnapshotVector3");
b.ToTable("EFACSnapshotVector3", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClient", b =>
@ -91,7 +92,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("NetworkId")
.IsUnique();
b.ToTable("EFClients");
b.ToTable("EFClients", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClientConnectionHistory", b =>
@ -123,7 +124,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("ServerId");
b.ToTable("EFClientConnectionHistory");
b.ToTable("EFClientConnectionHistory", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClientKill", b =>
@ -197,7 +198,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("ViewAnglesVector3Id");
b.ToTable("EFClientKills");
b.ToTable("EFClientKills", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFClientMessage", b =>
@ -232,7 +233,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("TimeSent");
b.ToTable("EFClientMessages");
b.ToTable("EFClientMessages", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFACSnapshot", b =>
@ -339,7 +340,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("ServerId");
b.ToTable("EFACSnapshot");
b.ToTable("EFACSnapshot", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientHitStatistic", b =>
@ -413,7 +414,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("WeaponId");
b.ToTable("EFClientHitStatistics");
b.ToTable("EFClientHitStatistics", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRankingHistory", b =>
@ -458,7 +459,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("ZScore");
b.ToTable("EFClientRankingHistory");
b.ToTable("EFClientRankingHistory", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRatingHistory", b =>
@ -477,7 +478,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("ClientId");
b.ToTable("EFClientRatingHistory");
b.ToTable("EFClientRatingHistory", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientStatistics", b =>
@ -535,7 +536,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("ClientId", "TimePlayed", "ZScore");
b.ToTable("EFClientStatistics");
b.ToTable("EFClientStatistics", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFHitLocationCount", b =>
@ -548,12 +549,12 @@ namespace Data.Migrations.Sqlite
.HasColumnType("INTEGER");
b.Property<int>("EFClientStatisticsClientId")
.HasColumnName("EFClientStatisticsClientId")
.HasColumnType("INTEGER");
.HasColumnType("INTEGER")
.HasColumnName("EFClientStatisticsClientId");
b.Property<long>("EFClientStatisticsServerId")
.HasColumnName("EFClientStatisticsServerId")
.HasColumnType("INTEGER");
.HasColumnType("INTEGER")
.HasColumnName("EFClientStatisticsServerId");
b.Property<int>("HitCount")
.HasColumnType("INTEGER");
@ -573,7 +574,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("EFClientStatisticsClientId", "EFClientStatisticsServerId");
b.ToTable("EFHitLocationCounts");
b.ToTable("EFHitLocationCounts", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.EFRating", b =>
@ -616,7 +617,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("When", "ServerId", "Performance", "ActivityAmount");
b.ToTable("EFRating");
b.ToTable("EFRating", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFHitLocation", b =>
@ -642,7 +643,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("Name");
b.ToTable("EFHitLocations");
b.ToTable("EFHitLocations", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFMap", b =>
@ -666,7 +667,7 @@ namespace Data.Migrations.Sqlite
b.HasKey("MapId");
b.ToTable("EFMaps");
b.ToTable("EFMaps", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFMeansOfDeath", b =>
@ -690,7 +691,7 @@ namespace Data.Migrations.Sqlite
b.HasKey("MeansOfDeathId");
b.ToTable("EFMeansOfDeath");
b.ToTable("EFMeansOfDeath", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeapon", b =>
@ -716,7 +717,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("Name");
b.ToTable("EFWeapons");
b.ToTable("EFWeapons", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeaponAttachment", b =>
@ -740,7 +741,7 @@ namespace Data.Migrations.Sqlite
b.HasKey("WeaponAttachmentId");
b.ToTable("EFWeaponAttachments");
b.ToTable("EFWeaponAttachments", (string)null);
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeaponAttachmentCombo", b =>
@ -775,7 +776,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("Attachment3Id");
b.ToTable("EFWeaponAttachmentCombos");
b.ToTable("EFWeaponAttachmentCombos", (string)null);
});
modelBuilder.Entity("Data.Models.EFAlias", b =>
@ -798,12 +799,12 @@ namespace Data.Migrations.Sqlite
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(24);
.HasMaxLength(24)
.HasColumnType("TEXT");
b.Property<string>("SearchableName")
.HasColumnType("TEXT")
.HasMaxLength(24);
.HasMaxLength(24)
.HasColumnType("TEXT");
b.HasKey("AliasId");
@ -817,7 +818,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("Name", "IPAddress");
b.ToTable("EFAlias");
b.ToTable("EFAlias", (string)null);
});
modelBuilder.Entity("Data.Models.EFAliasLink", b =>
@ -831,7 +832,7 @@ namespace Data.Migrations.Sqlite
b.HasKey("AliasLinkId");
b.ToTable("EFAliasLinks");
b.ToTable("EFAliasLinks", (string)null);
});
modelBuilder.Entity("Data.Models.EFChangeHistory", b =>
@ -844,8 +845,8 @@ namespace Data.Migrations.Sqlite
.HasColumnType("INTEGER");
b.Property<string>("Comment")
.HasColumnType("TEXT")
.HasMaxLength(128);
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("CurrentValue")
.HasColumnType("TEXT");
@ -893,8 +894,8 @@ namespace Data.Migrations.Sqlite
b.Property<string>("Key")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(32);
.HasMaxLength(32)
.HasColumnType("TEXT");
b.Property<int?>("LinkedMetaId")
.HasColumnType("INTEGER");
@ -935,7 +936,7 @@ namespace Data.Migrations.Sqlite
b.Property<bool>("IsEvadedOffense")
.HasColumnType("INTEGER");
b.Property<int>("LinkId")
b.Property<int?>("LinkId")
.HasColumnType("INTEGER");
b.Property<int>("OffenderId")
@ -962,7 +963,36 @@ namespace Data.Migrations.Sqlite
b.HasIndex("PunisherId");
b.ToTable("EFPenalties");
b.ToTable("EFPenalties", (string)null);
});
modelBuilder.Entity("Data.Models.EFPenaltyIdentifier", b =>
{
b.Property<int>("PenaltyIdentifierId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("Active")
.HasColumnType("INTEGER");
b.Property<int?>("IPv4Address")
.HasColumnType("INTEGER");
b.Property<long>("NetworkId")
.HasColumnType("INTEGER");
b.Property<int>("PenaltyId")
.HasColumnType("INTEGER");
b.HasKey("PenaltyIdentifierId");
b.HasIndex("IPv4Address");
b.HasIndex("NetworkId");
b.HasIndex("PenaltyId");
b.ToTable("EFPenaltyIdentifiers", (string)null);
});
modelBuilder.Entity("Data.Models.Misc.EFInboxMessage", b =>
@ -1028,7 +1058,7 @@ namespace Data.Migrations.Sqlite
b.HasKey("ServerId");
b.ToTable("EFServers");
b.ToTable("EFServers", (string)null);
});
modelBuilder.Entity("Data.Models.Server.EFServerSnapshot", b =>
@ -1061,7 +1091,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("ServerId");
b.ToTable("EFServerSnapshot");
b.ToTable("EFServerSnapshot", (string)null);
});
modelBuilder.Entity("Data.Models.Server.EFServerStatistics", b =>
@ -1086,7 +1116,7 @@ namespace Data.Migrations.Sqlite
b.HasIndex("ServerId");
b.ToTable("EFServerStatistics");
b.ToTable("EFServerStatistics", (string)null);
});
modelBuilder.Entity("Data.Models.Vector3", b =>
@ -1106,7 +1136,7 @@ namespace Data.Migrations.Sqlite
b.HasKey("Vector3Id");
b.ToTable("Vector3");
b.ToTable("Vector3", (string)null);
});
modelBuilder.Entity("Data.Models.Client.EFACSnapshotVector3", b =>
@ -1122,6 +1152,10 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("Vector3Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Snapshot");
b.Navigation("Vector");
});
modelBuilder.Entity("Data.Models.Client.EFClient", b =>
@ -1137,6 +1171,10 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("CurrentAliasId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AliasLink");
b.Navigation("CurrentAlias");
});
modelBuilder.Entity("Data.Models.Client.EFClientConnectionHistory", b =>
@ -1152,6 +1190,10 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.EFClientKill", b =>
@ -1185,6 +1227,18 @@ namespace Data.Migrations.Sqlite
b.HasOne("Data.Models.Vector3", "ViewAngles")
.WithMany()
.HasForeignKey("ViewAnglesVector3Id");
b.Navigation("Attacker");
b.Navigation("DeathOrigin");
b.Navigation("KillOrigin");
b.Navigation("Server");
b.Navigation("Victim");
b.Navigation("ViewAngles");
});
modelBuilder.Entity("Data.Models.Client.EFClientMessage", b =>
@ -1200,6 +1254,10 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFACSnapshot", b =>
@ -1237,6 +1295,18 @@ namespace Data.Migrations.Sqlite
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
b.Navigation("Client");
b.Navigation("CurrentViewAngle");
b.Navigation("HitDestination");
b.Navigation("HitOrigin");
b.Navigation("LastStrainAngle");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientHitStatistic", b =>
@ -1266,6 +1336,18 @@ namespace Data.Migrations.Sqlite
b.HasOne("Data.Models.Client.Stats.Reference.EFWeapon", "Weapon")
.WithMany()
.HasForeignKey("WeaponId");
b.Navigation("Client");
b.Navigation("HitLocation");
b.Navigation("MeansOfDeath");
b.Navigation("Server");
b.Navigation("Weapon");
b.Navigation("WeaponAttachmentCombo");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRankingHistory", b =>
@ -1279,6 +1361,10 @@ namespace Data.Migrations.Sqlite
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRatingHistory", b =>
@ -1288,6 +1374,8 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientStatistics", b =>
@ -1303,6 +1391,10 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFHitLocationCount", b =>
@ -1324,6 +1416,10 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("EFClientStatisticsClientId", "EFClientStatisticsServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFRating", b =>
@ -1337,6 +1433,10 @@ namespace Data.Migrations.Sqlite
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
b.Navigation("RatingHistory");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.Stats.Reference.EFWeaponAttachmentCombo", b =>
@ -1354,6 +1454,12 @@ namespace Data.Migrations.Sqlite
b.HasOne("Data.Models.Client.Stats.Reference.EFWeaponAttachment", "Attachment3")
.WithMany()
.HasForeignKey("Attachment3Id");
b.Navigation("Attachment1");
b.Navigation("Attachment2");
b.Navigation("Attachment3");
});
modelBuilder.Entity("Data.Models.EFAlias", b =>
@ -1363,6 +1469,8 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("LinkId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Link");
});
modelBuilder.Entity("Data.Models.EFMeta", b =>
@ -1375,15 +1483,17 @@ namespace Data.Migrations.Sqlite
.WithMany()
.HasForeignKey("LinkedMetaId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Client");
b.Navigation("LinkedMeta");
});
modelBuilder.Entity("Data.Models.EFPenalty", b =>
{
b.HasOne("Data.Models.EFAliasLink", "Link")
.WithMany("ReceivedPenalties")
.HasForeignKey("LinkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("LinkId");
b.HasOne("Data.Models.Client.EFClient", "Offender")
.WithMany("ReceivedPenalties")
@ -1396,6 +1506,23 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("PunisherId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Link");
b.Navigation("Offender");
b.Navigation("Punisher");
});
modelBuilder.Entity("Data.Models.EFPenaltyIdentifier", b =>
{
b.HasOne("Data.Models.EFPenalty", "Penalty")
.WithMany()
.HasForeignKey("PenaltyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Penalty");
});
modelBuilder.Entity("Data.Models.Misc.EFInboxMessage", b =>
@ -1415,6 +1542,12 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("SourceClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DestinationClient");
b.Navigation("Server");
b.Navigation("SourceClient");
});
modelBuilder.Entity("Data.Models.Server.EFServerSnapshot", b =>
@ -1430,6 +1563,10 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Map");
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Server.EFServerStatistics", b =>
@ -1439,6 +1576,39 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Server");
});
modelBuilder.Entity("Data.Models.Client.EFClient", b =>
{
b.Navigation("AdministeredPenalties");
b.Navigation("Meta");
b.Navigation("ReceivedPenalties");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFACSnapshot", b =>
{
b.Navigation("PredictedViewAngles");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientRatingHistory", b =>
{
b.Navigation("Ratings");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientStatistics", b =>
{
b.Navigation("HitLocations");
});
modelBuilder.Entity("Data.Models.EFAliasLink", b =>
{
b.Navigation("Children");
b.Navigation("ReceivedPenalties");
});
#pragma warning restore 612, 618
}

View File

@ -23,8 +23,7 @@ namespace Data.Models
[Key]
public int PenaltyId { get; set; }
[Required]
public int LinkId { get; set; }
public int? LinkId { get; set; }
[ForeignKey("LinkId")]
public virtual EFAliasLink Link { get; set; }
[Required]

View File

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Data.Models;
public class EFPenaltyIdentifier : SharedEntity
{
[Key]
public int PenaltyIdentifierId { get; set; }
public int? IPv4Address { get; set; }
[Required]
public long NetworkId { get; set; }
[Required]
public int PenaltyId { get; set; }
[ForeignKey(nameof(PenaltyId))]
public EFPenalty Penalty { get; set; }
}

View File

@ -378,29 +378,31 @@ namespace SharedLibraryCore.Commands
};
}
public override async Task ExecuteAsync(GameEvent E)
public override async Task ExecuteAsync(GameEvent gameEvent)
{
// todo: don't do the lookup here
var penalties = await E.Owner.Manager.GetPenaltyService().GetActivePenaltiesAsync(E.Target.AliasLinkId, E.Target.CurrentAliasId);
var penalties = await gameEvent.Owner.Manager.GetPenaltyService().GetActivePenaltiesAsync(gameEvent.Target.AliasLinkId,
gameEvent.Target.CurrentAliasId, gameEvent.Target.NetworkId, gameEvent.Target.CurrentAlias.IPAddress);
if (penalties
.FirstOrDefault(p =>
p.Type == EFPenalty.PenaltyType.Ban || p.Type == EFPenalty.PenaltyType.TempBan) != null)
{
switch ((await E.Target.Unban(E.Data, E.Origin)
.WaitAsync(Utilities.DefaultCommandTimeout, E.Owner.Manager.CancellationToken)).FailReason)
switch ((await gameEvent.Target.Unban(gameEvent.Data, gameEvent.Origin)
.WaitAsync(Utilities.DefaultCommandTimeout, gameEvent.Owner.Manager.CancellationToken)).FailReason)
{
case GameEvent.EventFailReason.None:
E.Origin.Tell(_translationLookup["COMMANDS_UNBAN_SUCCESS"].FormatExt(E.Target));
gameEvent.Origin.Tell(_translationLookup["COMMANDS_UNBAN_SUCCESS"].FormatExt(gameEvent.Target));
break;
default:
E.Origin.Tell(_translationLookup["SERVER_ERROR_COMMAND_INGAME"]);
gameEvent.Origin.Tell(_translationLookup["SERVER_ERROR_COMMAND_INGAME"]);
break;
}
}
else
{
E.Origin.Tell(_translationLookup["COMMANDS_UNBAN_FAIL"].FormatExt(E.Target));
gameEvent.Origin.Tell(_translationLookup["COMMANDS_UNBAN_FAIL"].FormatExt(gameEvent.Target));
}
}
}
@ -898,7 +900,7 @@ namespace SharedLibraryCore.Commands
public override async Task ExecuteAsync(GameEvent E)
{
var existingPenalties = await E.Owner.Manager.GetPenaltyService()
.GetActivePenaltiesAsync(E.Target.AliasLinkId, E.Target.CurrentAliasId, E.Target.IPAddress);
.GetActivePenaltiesAsync(E.Target.AliasLinkId, E.Target.CurrentAliasId, E.Target.NetworkId, E.Target.IPAddress);
var penalty = existingPenalties.FirstOrDefault(b => b.Type > EFPenalty.PenaltyType.Kick);
if (penalty == null)

View File

@ -653,7 +653,7 @@ namespace SharedLibraryCore.Database.Models
// we want to get any penalties that are tied to their IP or AliasLink (but not necessarily their GUID)
var activePenalties = await CurrentServer.Manager.GetPenaltyService()
.GetActivePenaltiesAsync(AliasLinkId, CurrentAliasId, ipAddress);
.GetActivePenaltiesAsync(AliasLinkId, CurrentAliasId, NetworkId, ipAddress);
var banPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.Ban);
var tempbanPenalty =
activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.TempBan);

View File

@ -464,7 +464,7 @@ namespace SharedLibraryCore.Services
// link2 is deleted
// link2 penalties are orphaned
await context.Penalties
.Where(_penalty => completeAliasLinkIds.Contains(_penalty.LinkId))
.Where(_penalty => completeAliasLinkIds.Contains(_penalty.LinkId ?? -1))
.ForEachAsync(_penalty => _penalty.LinkId = newAliasLink.AliasLinkId);
entity.AliasLink = newAliasLink;

View File

@ -31,7 +31,7 @@ namespace SharedLibraryCore.Services
Active = true,
OffenderId = newEntity.Offender.ClientId,
PunisherId = newEntity.Punisher.ClientId,
LinkId = newEntity.Link.AliasLinkId,
LinkId = newEntity.Link?.AliasLinkId,
Type = newEntity.Type,
Expires = newEntity.Expires,
Offense = newEntity.Offense,
@ -41,6 +41,18 @@ namespace SharedLibraryCore.Services
IsEvadedOffense = newEntity.IsEvadedOffense
};
if (LinkedPenalties.Contains(newEntity.Type))
{
var penaltyIdentifiers = new EFPenaltyIdentifier
{
Penalty = penalty,
NetworkId = newEntity.Offender.NetworkId,
IPv4Address = newEntity.Offender.CurrentAlias.IPAddress
};
context.PenaltyIdentifiers.Add(penaltyIdentifiers);
}
context.Penalties.Add(penalty);
await context.SaveChangesAsync();
@ -103,65 +115,26 @@ namespace SharedLibraryCore.Services
return await iqPenalties.ToListAsync();
}
/// <summary>
/// retrieves penalty information for meta service
/// </summary>
/// <param name="clientId">database id of the client</param>
/// <param name="count">how many items to retrieve</param>
/// <param name="offset">not used</param>
/// <param name="startAt">retreive penalties older than this</param>
/// <returns></returns>
public async Task<IList<PenaltyInfo>> GetClientPenaltyForMetaAsync(int clientId, int count, int offset,
DateTime? startAt)
private static readonly EFPenalty.PenaltyType[] LinkedPenalties =
{ EFPenalty.PenaltyType.Ban, EFPenalty.PenaltyType.Flag };
private static readonly Expression<Func<EFPenalty, bool>> Filter = p =>
LinkedPenalties.Contains(p.Type) && p.Active && (p.Expires == null || p.Expires > DateTime.UtcNow);
private static readonly Expression<Func<EFPenaltyIdentifier, bool>> FilterById = pi =>
LinkedPenalties.Contains(pi.Penalty.Type) && pi.Penalty.Active &&
(pi.Penalty.Expires == null || pi.Penalty.Expires > DateTime.UtcNow);
public async Task<List<EFPenalty>> GetActivePenaltiesAsync(int linkId, int currentAliasId, long networkId,
int? ip = null)
{
var linkedPenaltyType = Utilities.LinkedPenaltyTypes();
var penaltiesByIdentifier = await GetActivePenaltiesByIdentifier(ip, networkId);
await using var context = _contextFactory.CreateContext(false);
var linkId = await context.Clients.AsNoTracking()
.Where(_penalty => _penalty.ClientId == clientId)
.Select(_penalty => _penalty.AliasLinkId)
.FirstOrDefaultAsync();
var iqPenalties = context.Penalties.AsNoTracking()
.Where(_penalty => _penalty.OffenderId == clientId || _penalty.PunisherId == clientId ||
linkedPenaltyType.Contains(_penalty.Type) && _penalty.LinkId == linkId)
.Where(_penalty => _penalty.When <= startAt)
.OrderByDescending(_penalty => _penalty.When)
.Skip(offset)
.Take(count)
.Select(_penalty => new PenaltyInfo
if (penaltiesByIdentifier.Any())
{
Id = _penalty.PenaltyId,
Offense = _penalty.Offense,
AutomatedOffense = _penalty.AutomatedOffense,
OffenderId = _penalty.OffenderId,
OffenderName = _penalty.Offender.CurrentAlias.Name,
PunisherId = _penalty.PunisherId,
PunisherName = _penalty.Punisher.CurrentAlias.Name,
PunisherLevel = _penalty.Punisher.Level,
PenaltyType = _penalty.Type,
Expires = _penalty.Expires,
TimePunished = _penalty.When,
IsEvade = _penalty.IsEvadedOffense
});
return await iqPenalties.Distinct().ToListAsync();
return penaltiesByIdentifier;
}
public async Task<List<EFPenalty>> GetActivePenaltiesAsync(int linkId, int currentAliasId, int? ip = null,
bool includePunisherName = false)
{
var now = DateTime.UtcNow;
Expression<Func<EFPenalty, bool>> filter = p => new[]
{
EFPenalty.PenaltyType.TempBan,
EFPenalty.PenaltyType.Ban,
EFPenalty.PenaltyType.Flag
}.Contains(p.Type) &&
p.Active &&
(p.Expires == null || p.Expires > now);
await using var context = _contextFactory.CreateContext(false);
IQueryable<EFPenalty> iqIpPenalties;
@ -171,12 +144,13 @@ namespace SharedLibraryCore.Services
iqIpPenalties = context.Aliases
.Where(a => a.IPAddress != null && a.IPAddress == ip)
.SelectMany(a => a.Link.ReceivedPenalties)
.Where(filter);
.Where(Filter);
}
else
{
var usedIps = await context.Aliases.AsNoTracking()
.Where(alias => (alias.LinkId == linkId || alias.AliasId == currentAliasId) && alias.IPAddress != null)
.Where(alias =>
(alias.LinkId == linkId || alias.AliasId == currentAliasId) && alias.IPAddress != null)
.Select(alias => alias.IPAddress).ToListAsync();
var aliasedIds = await context.Aliases.AsNoTracking().Where(alias => usedIps.Contains(alias.IPAddress))
@ -184,8 +158,8 @@ namespace SharedLibraryCore.Services
.ToListAsync();
iqIpPenalties = context.Penalties.AsNoTracking()
.Where(penalty => aliasedIds.Contains(penalty.LinkId) || penalty.LinkId == linkId)
.Where(filter);
.Where(penalty => aliasedIds.Contains(penalty.LinkId ?? -1) || penalty.LinkId == linkId)
.Where(Filter);
}
var activeIpPenalties = await iqIpPenalties.ToListAsync();
@ -195,11 +169,35 @@ namespace SharedLibraryCore.Services
return activePenalties.OrderByDescending(p => p.When).ToList();
}
public virtual async Task RemoveActivePenalties(int aliasLinkId, int? ipAddress = null)
public async Task<List<EFPenalty>> GetActivePenaltiesByIdentifier(int? ip, long networkId)
{
await using var context = _contextFactory.CreateContext(false);
var activePenaltiesIds = context.PenaltyIdentifiers.Where(identifier =>
identifier.IPv4Address != null && identifier.IPv4Address == ip || identifier.NetworkId == networkId)
.Where(FilterById);
return await activePenaltiesIds.Select(ids => ids.Penalty).ToListAsync();
}
public virtual async Task RemoveActivePenalties(int aliasLinkId, long networkId, int? ipAddress = null)
{
await using var context = _contextFactory.CreateContext();
var now = DateTime.UtcNow;
var activePenalties = await GetActivePenaltiesByIdentifier(ipAddress, networkId);
if (activePenalties.Any())
{
var ids = activePenalties.Select(penalty => penalty.PenaltyId);
await context.Penalties.Where(penalty => ids.Contains(penalty.PenaltyId))
.ForEachAsync(penalty =>
{
penalty.Active = false;
penalty.Expires = now;
});
await context.SaveChangesAsync();
return;
}
var penaltiesByLink = context.Penalties
.Where(p => p.LinkId == aliasLinkId)
.Where(p => p.Expires > now || p.Expires == null);

View File

@ -4,7 +4,7 @@
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<PackageId>RaidMax.IW4MAdmin.SharedLibraryCore</PackageId>
<Version>2022.01.28.1</Version>
<Version>2022.2.22.1</Version>
<Authors>RaidMax</Authors>
<Company>Forever None</Company>
<Configurations>Debug;Release;Prerelease</Configurations>
@ -19,7 +19,7 @@
<IsPackable>true</IsPackable>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Description>Shared Library for IW4MAdmin</Description>
<PackageVersion>2022.01.28.1</PackageVersion>
<PackageVersion>2022.2.22.1</PackageVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">

View File

@ -35,7 +35,8 @@ namespace WebfrontCore.Controllers
return NotFound();
}
var activePenalties = await Manager.GetPenaltyService().GetActivePenaltiesAsync(client.AliasLinkId, client.CurrentAliasId, client.IPAddress);
var activePenalties = await Manager.GetPenaltyService().GetActivePenaltiesAsync(client.AliasLinkId,
client.CurrentAliasId, client.NetworkId, client.IPAddress);
var persistentMetaTask = new[]
{