using System; using Microsoft.EntityFrameworkCore.Migrations; namespace Data.Migrations.Sqlite { public partial class AddAdditionalClientStatsAndZScore : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "UpdatedAt", table: "EFClientStatistics", nullable: true); migrationBuilder.AddColumn( name: "ZScore", table: "EFClientStatistics", nullable: false, defaultValue: 0.0); migrationBuilder.CreateTable( name: "EFHitLocations", columns: table => new { HitLocationId = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), CreatedDateTime = table.Column(nullable: false), UpdatedDateTime = table.Column(nullable: true), Name = table.Column(nullable: false), Game = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_EFHitLocations", x => x.HitLocationId); }); migrationBuilder.CreateTable( name: "EFMaps", columns: table => new { MapId = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), CreatedDateTime = table.Column(nullable: false), UpdatedDateTime = table.Column(nullable: true), Name = table.Column(nullable: false), Game = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_EFMaps", x => x.MapId); }); migrationBuilder.CreateTable( name: "EFMeansOfDeath", columns: table => new { MeansOfDeathId = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), CreatedDateTime = table.Column(nullable: false), UpdatedDateTime = table.Column(nullable: true), Name = table.Column(nullable: false), Game = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_EFMeansOfDeath", x => x.MeansOfDeathId); }); migrationBuilder.CreateTable( name: "EFWeaponAttachments", columns: table => new { WeaponAttachmentId = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), CreatedDateTime = table.Column(nullable: false), UpdatedDateTime = table.Column(nullable: true), Name = table.Column(nullable: false), Game = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_EFWeaponAttachments", x => x.WeaponAttachmentId); }); migrationBuilder.CreateTable( name: "EFWeapons", columns: table => new { WeaponId = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), CreatedDateTime = table.Column(nullable: false), UpdatedDateTime = table.Column(nullable: true), Name = table.Column(nullable: false), Game = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_EFWeapons", x => x.WeaponId); }); migrationBuilder.CreateTable( name: "EFWeaponAttachmentCombos", columns: table => new { WeaponAttachmentComboId = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), CreatedDateTime = table.Column(nullable: false), UpdatedDateTime = table.Column(nullable: true), Game = table.Column(nullable: false), Attachment1Id = table.Column(nullable: false), Attachment2Id = table.Column(nullable: true), Attachment3Id = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFWeaponAttachmentCombos", x => x.WeaponAttachmentComboId); table.ForeignKey( name: "FK_EFWeaponAttachmentCombos_EFWeaponAttachments_Attachment1Id", column: x => x.Attachment1Id, principalTable: "EFWeaponAttachments", principalColumn: "WeaponAttachmentId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_EFWeaponAttachmentCombos_EFWeaponAttachments_Attachment2Id", column: x => x.Attachment2Id, principalTable: "EFWeaponAttachments", principalColumn: "WeaponAttachmentId", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_EFWeaponAttachmentCombos_EFWeaponAttachments_Attachment3Id", column: x => x.Attachment3Id, principalTable: "EFWeaponAttachments", principalColumn: "WeaponAttachmentId", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "EFClientHitStatistics", columns: table => new { ClientHitStatisticId = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), CreatedDateTime = table.Column(nullable: false), UpdatedDateTime = table.Column(nullable: true), ClientId = table.Column(nullable: false), ServerId = table.Column(nullable: true), HitLocationId = table.Column(nullable: true), MeansOfDeathId = table.Column(nullable: true), WeaponId = table.Column(nullable: true), WeaponAttachmentComboId = table.Column(nullable: true), HitCount = table.Column(nullable: false), KillCount = table.Column(nullable: false), DamageInflicted = table.Column(nullable: false), ReceivedHitCount = table.Column(nullable: false), DeathCount = table.Column(nullable: false), DamageReceived = table.Column(nullable: false), SuicideCount = table.Column(nullable: false), UsageSeconds = table.Column(nullable: true), Score = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_EFClientHitStatistics", x => x.ClientHitStatisticId); table.ForeignKey( name: "FK_EFClientHitStatistics_EFClients_ClientId", column: x => x.ClientId, principalTable: "EFClients", principalColumn: "ClientId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_EFClientHitStatistics_EFHitLocations_HitLocationId", column: x => x.HitLocationId, principalTable: "EFHitLocations", principalColumn: "HitLocationId", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_EFClientHitStatistics_EFMeansOfDeath_MeansOfDeathId", column: x => x.MeansOfDeathId, principalTable: "EFMeansOfDeath", principalColumn: "MeansOfDeathId", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_EFClientHitStatistics_EFServers_ServerId", column: x => x.ServerId, principalTable: "EFServers", principalColumn: "ServerId", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_EFClientHitStatistics_EFWeaponAttachmentCombos_WeaponAttachmentComboId", column: x => x.WeaponAttachmentComboId, principalTable: "EFWeaponAttachmentCombos", principalColumn: "WeaponAttachmentComboId", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_EFClientHitStatistics_EFWeapons_WeaponId", column: x => x.WeaponId, principalTable: "EFWeapons", principalColumn: "WeaponId", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_EFClientStatistics_ZScore", table: "EFClientStatistics", column: "ZScore"); migrationBuilder.CreateIndex( name: "IX_EFClientStatistics_ClientId_TimePlayed_ZScore", table: "EFClientStatistics", columns: new[] { "ClientId", "TimePlayed", "ZScore" }); migrationBuilder.CreateIndex( name: "IX_EFClientHitStatistics_ClientId", table: "EFClientHitStatistics", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_EFClientHitStatistics_HitLocationId", table: "EFClientHitStatistics", column: "HitLocationId"); migrationBuilder.CreateIndex( name: "IX_EFClientHitStatistics_MeansOfDeathId", table: "EFClientHitStatistics", column: "MeansOfDeathId"); migrationBuilder.CreateIndex( name: "IX_EFClientHitStatistics_ServerId", table: "EFClientHitStatistics", column: "ServerId"); migrationBuilder.CreateIndex( name: "IX_EFClientHitStatistics_WeaponAttachmentComboId", table: "EFClientHitStatistics", column: "WeaponAttachmentComboId"); migrationBuilder.CreateIndex( name: "IX_EFClientHitStatistics_WeaponId", table: "EFClientHitStatistics", column: "WeaponId"); migrationBuilder.CreateIndex( name: "IX_EFHitLocations_Name", table: "EFHitLocations", column: "Name"); migrationBuilder.CreateIndex( name: "IX_EFWeaponAttachmentCombos_Attachment1Id", table: "EFWeaponAttachmentCombos", column: "Attachment1Id"); migrationBuilder.CreateIndex( name: "IX_EFWeaponAttachmentCombos_Attachment2Id", table: "EFWeaponAttachmentCombos", column: "Attachment2Id"); migrationBuilder.CreateIndex( name: "IX_EFWeaponAttachmentCombos_Attachment3Id", table: "EFWeaponAttachmentCombos", column: "Attachment3Id"); migrationBuilder.CreateIndex( name: "IX_EFWeapons_Name", table: "EFWeapons", column: "Name"); } protected override void Down(MigrationBuilder migrationBuilder) { } } }