using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Data.Migrations.Sqlite { public partial class AddZombieStatsInitial : 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: "EFZombieMatch", 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), EFClientClientId = 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_EFZombieMatch", x => x.ZombieMatchId); table.ForeignKey( name: "FK_EFZombieMatch_EFClients_EFClientClientId", column: x => x.EFClientClientId, principalTable: "EFClients", principalColumn: "ClientId"); table.ForeignKey( name: "FK_EFZombieMatch_EFMaps_MapId", column: x => x.MapId, principalTable: "EFMaps", principalColumn: "MapId"); table.ForeignKey( name: "FK_EFZombieMatch_EFServers_ServerId", column: x => x.ServerId, principalTable: "EFServers", principalColumn: "ServerId"); }); migrationBuilder.CreateTable( name: "EFZombieClientStat", 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), 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_EFZombieClientStat", x => x.ZombieClientStatId); table.ForeignKey( name: "FK_EFZombieClientStat_EFClients_ClientId", column: x => x.ClientId, principalTable: "EFClients", principalColumn: "ClientId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_EFZombieClientStat_EFZombieMatch_MatchId", column: x => x.MatchId, principalTable: "EFZombieMatch", principalColumn: "ZombieMatchId"); }); migrationBuilder.CreateTable( name: "EFZombieAggregateClientStat", columns: table => new { ZombieClientStatId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", 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), EFClientClientId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFZombieAggregateClientStat", x => x.ZombieClientStatId); table.ForeignKey( name: "FK_EFZombieAggregateClientStat_EFClients_EFClientClientId", column: x => x.EFClientClientId, principalTable: "EFClients", principalColumn: "ClientId"); table.ForeignKey( name: "FK_EFZombieAggregateClientStat_EFZombieClientStat_ZombieClientStatId", column: x => x.ZombieClientStatId, principalTable: "EFZombieClientStat", principalColumn: "ZombieClientStatId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "EFZombieMatchClientStat", columns: table => new { ZombieClientStatId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), EFClientClientId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFZombieMatchClientStat", x => x.ZombieClientStatId); table.ForeignKey( name: "FK_EFZombieMatchClientStat_EFClients_EFClientClientId", column: x => x.EFClientClientId, principalTable: "EFClients", principalColumn: "ClientId"); table.ForeignKey( name: "FK_EFZombieMatchClientStat_EFZombieClientStat_ZombieClientStatId", column: x => x.ZombieClientStatId, principalTable: "EFZombieClientStat", principalColumn: "ZombieClientStatId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "EFZombieRoundClientStat", 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), EFClientClientId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFZombieRoundClientStat", x => x.ZombieClientStatId); table.ForeignKey( name: "FK_EFZombieRoundClientStat_EFClients_EFClientClientId", column: x => x.EFClientClientId, principalTable: "EFClients", principalColumn: "ClientId"); table.ForeignKey( name: "FK_EFZombieRoundClientStat_EFZombieClientStat_ZombieClientStatId", column: x => x.ZombieClientStatId, principalTable: "EFZombieClientStat", principalColumn: "ZombieClientStatId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "EFZombieClientStatRecord", 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_EFZombieClientStatRecord", x => x.ZombieClientStatRecordId); table.ForeignKey( name: "FK_EFZombieClientStatRecord_EFClients_ClientId", column: x => x.ClientId, principalTable: "EFClients", principalColumn: "ClientId"); table.ForeignKey( name: "FK_EFZombieClientStatRecord_EFZombieRoundClientStat_RoundId", column: x => x.RoundId, principalTable: "EFZombieRoundClientStat", principalColumn: "ZombieClientStatId"); }); migrationBuilder.CreateIndex( name: "IX_EFZombieAggregateClientStat_EFClientClientId", table: "EFZombieAggregateClientStat", column: "EFClientClientId"); migrationBuilder.CreateIndex( name: "IX_EFZombieClientStat_ClientId", table: "EFZombieClientStat", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_EFZombieClientStat_MatchId", table: "EFZombieClientStat", column: "MatchId"); migrationBuilder.CreateIndex( name: "IX_EFZombieClientStatRecord_ClientId", table: "EFZombieClientStatRecord", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_EFZombieClientStatRecord_RoundId", table: "EFZombieClientStatRecord", column: "RoundId"); migrationBuilder.CreateIndex( name: "IX_EFZombieMatch_EFClientClientId", table: "EFZombieMatch", column: "EFClientClientId"); migrationBuilder.CreateIndex( name: "IX_EFZombieMatch_MapId", table: "EFZombieMatch", column: "MapId"); migrationBuilder.CreateIndex( name: "IX_EFZombieMatch_ServerId", table: "EFZombieMatch", column: "ServerId"); migrationBuilder.CreateIndex( name: "IX_EFZombieMatchClientStat_EFClientClientId", table: "EFZombieMatchClientStat", column: "EFClientClientId"); migrationBuilder.CreateIndex( name: "IX_EFZombieRoundClientStat_EFClientClientId", table: "EFZombieRoundClientStat", column: "EFClientClientId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "EFZombieAggregateClientStat"); migrationBuilder.DropTable( name: "EFZombieClientStatRecord"); migrationBuilder.DropTable( name: "EFZombieMatchClientStat"); migrationBuilder.DropTable( name: "EFZombieRoundClientStat"); migrationBuilder.DropTable( name: "EFZombieClientStat"); migrationBuilder.DropTable( name: "EFZombieMatch"); migrationBuilder.DropColumn( name: "PerformanceBucket", table: "EFServers"); migrationBuilder.DropColumn( name: "PerformanceBucket", table: "EFClientRankingHistory"); } } }