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