using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Data.Migrations.Sqlite { /// public partial class InitialZombieStats : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "PerformanceBucket", table: "EFServers", type: "TEXT", nullable: true); migrationBuilder.AddColumn( name: "PerformanceBucket", table: "EFClientRankingHistory", type: "TEXT", nullable: true); migrationBuilder.CreateTable( name: "EFClientStatTags", columns: table => new { ZombieStatTagId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), TagName = table.Column(type: "TEXT", maxLength: 128, nullable: true), CreatedDateTime = table.Column(type: "TEXT", nullable: false), UpdatedDateTime = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFClientStatTags", x => x.ZombieStatTagId); }); migrationBuilder.CreateTable( name: "EFZombieMatches", columns: table => new { ZombieMatchId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), MapId = table.Column(type: "INTEGER", nullable: true), ServerId = table.Column(type: "INTEGER", nullable: true), ClientsCompleted = table.Column(type: "INTEGER", nullable: false), MatchStartDate = table.Column(type: "TEXT", nullable: false), MatchEndDate = table.Column(type: "TEXT", nullable: true), CreatedDateTime = table.Column(type: "TEXT", nullable: false), UpdatedDateTime = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFZombieMatches", x => x.ZombieMatchId); table.ForeignKey( name: "FK_EFZombieMatches_EFMaps_MapId", column: x => x.MapId, principalTable: "EFMaps", principalColumn: "MapId"); table.ForeignKey( name: "FK_EFZombieMatches_EFServers_ServerId", column: x => x.ServerId, principalTable: "EFServers", principalColumn: "ServerId"); }); migrationBuilder.CreateTable( name: "EFClientStatTagValues", columns: table => new { ZombieClientStatTagValueId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), StatValue = table.Column(type: "INTEGER", nullable: true), StatTagId = table.Column(type: "INTEGER", nullable: false), ClientId = table.Column(type: "INTEGER", nullable: false), CreatedDateTime = table.Column(type: "TEXT", nullable: false), UpdatedDateTime = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFClientStatTagValues", x => x.ZombieClientStatTagValueId); table.ForeignKey( name: "FK_EFClientStatTagValues_EFClientStatTags_StatTagId", column: x => x.StatTagId, principalTable: "EFClientStatTags", principalColumn: "ZombieStatTagId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_EFClientStatTagValues_EFClients_ClientId", column: x => x.ClientId, principalTable: "EFClients", principalColumn: "ClientId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "EFZombieClientStats", columns: table => new { ZombieClientStatId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), MatchId = table.Column(type: "INTEGER", nullable: true), ClientId = table.Column(type: "INTEGER", nullable: false), Kills = table.Column(type: "INTEGER", nullable: false), Deaths = table.Column(type: "INTEGER", nullable: false), DamageDealt = table.Column(type: "INTEGER", nullable: false), DamageReceived = table.Column(type: "INTEGER", nullable: false), Headshots = table.Column(type: "INTEGER", nullable: false), HeadshotKills = table.Column(type: "INTEGER", nullable: false), Melees = table.Column(type: "INTEGER", nullable: false), Downs = table.Column(type: "INTEGER", nullable: false), Revives = table.Column(type: "INTEGER", nullable: false), PointsEarned = table.Column(type: "INTEGER", nullable: false), PointsSpent = table.Column(type: "INTEGER", nullable: false), PerksConsumed = table.Column(type: "INTEGER", nullable: false), PowerupsGrabbed = table.Column(type: "INTEGER", nullable: false), CreatedDateTime = table.Column(type: "TEXT", nullable: false), UpdatedDateTime = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFZombieClientStats", x => x.ZombieClientStatId); table.ForeignKey( name: "FK_EFZombieClientStats_EFClients_ClientId", column: x => x.ClientId, principalTable: "EFClients", principalColumn: "ClientId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_EFZombieClientStats_EFZombieMatches_MatchId", column: x => x.MatchId, principalTable: "EFZombieMatches", principalColumn: "ZombieMatchId"); }); migrationBuilder.CreateTable( name: "EFZombieEvents", columns: table => new { ZombieEventLogId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), EventType = table.Column(type: "INTEGER", nullable: false), SourceClientId = table.Column(type: "INTEGER", nullable: true), AssociatedClientId = table.Column(type: "INTEGER", nullable: true), NumericalValue = table.Column(type: "REAL", nullable: true), TextualValue = table.Column(type: "TEXT", nullable: true), MatchId = table.Column(type: "INTEGER", nullable: true), CreatedDateTime = table.Column(type: "TEXT", nullable: false), UpdatedDateTime = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFZombieEvents", x => x.ZombieEventLogId); table.ForeignKey( name: "FK_EFZombieEvents_EFClients_AssociatedClientId", column: x => x.AssociatedClientId, principalTable: "EFClients", principalColumn: "ClientId"); table.ForeignKey( name: "FK_EFZombieEvents_EFClients_SourceClientId", column: x => x.SourceClientId, principalTable: "EFClients", principalColumn: "ClientId"); table.ForeignKey( name: "FK_EFZombieEvents_EFZombieMatches_MatchId", column: x => x.MatchId, principalTable: "EFZombieMatches", principalColumn: "ZombieMatchId"); }); migrationBuilder.CreateTable( name: "EFZombieClientStatAggregates", columns: table => new { ZombieClientStatId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), ServerId = table.Column(type: "INTEGER", nullable: true), AverageKillsPerDown = table.Column(type: "REAL", nullable: false), AverageDowns = table.Column(type: "REAL", nullable: false), AverageRevives = table.Column(type: "REAL", nullable: false), HeadshotPercentage = table.Column(type: "REAL", nullable: false), AlivePercentage = table.Column(type: "REAL", nullable: false), AverageMelees = table.Column(type: "REAL", nullable: false), AverageRoundReached = table.Column(type: "REAL", nullable: false), AveragePoints = table.Column(type: "REAL", nullable: false), HighestRound = table.Column(type: "INTEGER", nullable: false), TotalRoundsPlayed = table.Column(type: "INTEGER", nullable: false), TotalMatchesPlayed = table.Column(type: "INTEGER", nullable: false), TotalMatchesCompleted = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_EFZombieClientStatAggregates", x => x.ZombieClientStatId); table.ForeignKey( name: "FK_EFZombieClientStatAggregates_EFServers_ServerId", column: x => x.ServerId, principalTable: "EFServers", principalColumn: "ServerId"); table.ForeignKey( name: "FK_EFZombieClientStatAggregates_EFZombieClientStats_ZombieClientStatId", column: x => x.ZombieClientStatId, principalTable: "EFZombieClientStats", principalColumn: "ZombieClientStatId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "EFZombieMatchClientStats", columns: table => new { ZombieClientStatId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true) }, constraints: table => { table.PrimaryKey("PK_EFZombieMatchClientStats", x => x.ZombieClientStatId); table.ForeignKey( name: "FK_EFZombieMatchClientStats_EFZombieClientStats_ZombieClientStatId", column: x => x.ZombieClientStatId, principalTable: "EFZombieClientStats", principalColumn: "ZombieClientStatId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "EFZombieRoundClientStats", columns: table => new { ZombieClientStatId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), StartTime = table.Column(type: "TEXT", nullable: false), EndTime = table.Column(type: "TEXT", nullable: true), Duration = table.Column(type: "TEXT", nullable: true), TimeAlive = table.Column(type: "TEXT", nullable: true), RoundNumber = table.Column(type: "INTEGER", nullable: false), Points = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_EFZombieRoundClientStats", x => x.ZombieClientStatId); table.ForeignKey( name: "FK_EFZombieRoundClientStats_EFZombieClientStats_ZombieClientStatId", column: x => x.ZombieClientStatId, principalTable: "EFZombieClientStats", principalColumn: "ZombieClientStatId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "EFZombieClientStatRecords", columns: table => new { ZombieClientStatRecordId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false), Type = table.Column(type: "TEXT", nullable: false), Value = table.Column(type: "TEXT", nullable: false), ClientId = table.Column(type: "INTEGER", nullable: true), RoundId = table.Column(type: "INTEGER", nullable: true), CreatedDateTime = table.Column(type: "TEXT", nullable: false), UpdatedDateTime = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFZombieClientStatRecords", x => x.ZombieClientStatRecordId); table.ForeignKey( name: "FK_EFZombieClientStatRecords_EFClients_ClientId", column: x => x.ClientId, principalTable: "EFClients", principalColumn: "ClientId"); table.ForeignKey( name: "FK_EFZombieClientStatRecords_EFZombieRoundClientStats_RoundId", column: x => x.RoundId, principalTable: "EFZombieRoundClientStats", principalColumn: "ZombieClientStatId"); }); migrationBuilder.CreateIndex( name: "IX_EFClientStatTagValues_ClientId", table: "EFClientStatTagValues", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_EFClientStatTagValues_StatTagId", table: "EFClientStatTagValues", column: "StatTagId"); migrationBuilder.CreateIndex( name: "IX_EFZombieClientStatAggregates_ServerId", table: "EFZombieClientStatAggregates", column: "ServerId"); migrationBuilder.CreateIndex( name: "IX_EFZombieClientStatRecords_ClientId", table: "EFZombieClientStatRecords", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_EFZombieClientStatRecords_RoundId", table: "EFZombieClientStatRecords", column: "RoundId"); migrationBuilder.CreateIndex( name: "IX_EFZombieClientStats_ClientId", table: "EFZombieClientStats", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_EFZombieClientStats_MatchId", table: "EFZombieClientStats", column: "MatchId"); migrationBuilder.CreateIndex( name: "IX_EFZombieEvents_AssociatedClientId", table: "EFZombieEvents", column: "AssociatedClientId"); migrationBuilder.CreateIndex( name: "IX_EFZombieEvents_MatchId", table: "EFZombieEvents", column: "MatchId"); migrationBuilder.CreateIndex( name: "IX_EFZombieEvents_SourceClientId", table: "EFZombieEvents", column: "SourceClientId"); migrationBuilder.CreateIndex( name: "IX_EFZombieMatches_MapId", table: "EFZombieMatches", column: "MapId"); migrationBuilder.CreateIndex( name: "IX_EFZombieMatches_ServerId", table: "EFZombieMatches", column: "ServerId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "EFClientStatTagValues"); migrationBuilder.DropTable( name: "EFZombieClientStatAggregates"); migrationBuilder.DropTable( name: "EFZombieClientStatRecords"); migrationBuilder.DropTable( name: "EFZombieEvents"); migrationBuilder.DropTable( name: "EFZombieMatchClientStats"); migrationBuilder.DropTable( name: "EFClientStatTags"); migrationBuilder.DropTable( name: "EFZombieRoundClientStats"); migrationBuilder.DropTable( name: "EFZombieClientStats"); migrationBuilder.DropTable( name: "EFZombieMatches"); migrationBuilder.DropColumn( name: "PerformanceBucket", table: "EFServers"); migrationBuilder.DropColumn( name: "PerformanceBucket", table: "EFClientRankingHistory"); } } }