using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SystemRevivalServer.Migrations { /// public partial class Cleanup : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "game_recipes"); migrationBuilder.DropTable( name: "match_history"); migrationBuilder.DropTable( name: "player_stats"); migrationBuilder.DropTable( name: "game_items"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "game_items", columns: table => new { Id = table.Column(type: "int", nullable: false), AmmoType = table.Column(type: "int", nullable: false), Category = table.Column(type: "int", nullable: false), CraftCost = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), Damage = table.Column(type: "int", nullable: false), DamageReduction = table.Column(type: "float", nullable: false), DashCooldown = table.Column(type: "float", nullable: false), DashDistance = table.Column(type: "float", nullable: false), Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ExplosionRadius = table.Column(type: "float", nullable: false), FireRate = table.Column(type: "float", nullable: false), HarvestMultiplier = table.Column(type: "float", nullable: false), HealAmount = table.Column(type: "int", nullable: false), HealthBonus = table.Column(type: "int", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), LootValue = table.Column(type: "int", nullable: false), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), PelletCount = table.Column(type: "int", nullable: false), ProjectileSpeed = table.Column(type: "float", nullable: false), Range = table.Column(type: "float", nullable: false), ScanCooldown = table.Column(type: "float", nullable: false), ScanRadius = table.Column(type: "float", nullable: false), ShieldBoostDuration = table.Column(type: "float", nullable: false), ShieldDuration = table.Column(type: "float", nullable: false), ShieldHealth = table.Column(type: "int", nullable: false), SpeedBoostDuration = table.Column(type: "float", nullable: false), SpeedMultiplier = table.Column(type: "float", nullable: false), SpeedPenalty = table.Column(type: "float", nullable: false), Spread = table.Column(type: "float", nullable: false), Stackable = table.Column(type: "tinyint(1)", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) }, constraints: table => { table.PrimaryKey("PK_game_items", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "match_history", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), AccountId = table.Column(type: "bigint unsigned", nullable: false), DamageDealt = table.Column(type: "int", nullable: false), DamageTaken = table.Column(type: "int", nullable: false), Deaths = table.Column(type: "int", nullable: false), EloAfter = table.Column(type: "int", nullable: false), EloChange = table.Column(type: "int", nullable: false), EnergyCollected = table.Column(type: "int", nullable: false), ItemsCrafted = table.Column(type: "int", nullable: false), Kills = table.Column(type: "int", nullable: false), MatchDurationSeconds = table.Column(type: "int", nullable: false), MatchId = table.Column(type: "varchar(32)", maxLength: 32, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Placement = table.Column(type: "int", nullable: false), PlayedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), RareCollected = table.Column(type: "int", nullable: false), Result = table.Column(type: "int", nullable: false), ScrapCollected = table.Column(type: "int", nullable: false), SurvivalTimeSeconds = table.Column(type: "int", nullable: false), TotalPlayers = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_match_history", x => x.Id); table.ForeignKey( name: "FK_match_history_accounts_AccountId", column: x => x.AccountId, principalTable: "accounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "player_stats", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), AccountId = table.Column(type: "bigint unsigned", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), Deaths = table.Column(type: "int", nullable: false), Elo = table.Column(type: "int", nullable: false, defaultValue: 1000), Extractions = table.Column(type: "int", nullable: false), ItemsCrafted = table.Column(type: "int", nullable: false), Kills = table.Column(type: "int", nullable: false), LongestSurvivalSeconds = table.Column(type: "int", nullable: false), Losses = table.Column(type: "int", nullable: false), MatchesPlayed = table.Column(type: "int", nullable: false), TotalDamageDealt = table.Column(type: "bigint", nullable: false), TotalDamageTaken = table.Column(type: "bigint", nullable: false), TotalEnergyCollected = table.Column(type: "bigint", nullable: false), TotalPlayTimeSeconds = table.Column(type: "bigint", nullable: false), TotalRareCollected = table.Column(type: "bigint", nullable: false), TotalScrapCollected = table.Column(type: "bigint", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn), Wins = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_player_stats", x => x.Id); table.ForeignKey( name: "FK_player_stats_accounts_AccountId", column: x => x.AccountId, principalTable: "accounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "game_recipes", columns: table => new { Id = table.Column(type: "int", nullable: false), ResultItemId = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), EnergyCost = table.Column(type: "int", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), RareCost = table.Column(type: "int", nullable: false), ScrapCost = table.Column(type: "int", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) }, constraints: table => { table.PrimaryKey("PK_game_recipes", x => x.Id); table.ForeignKey( name: "FK_game_recipes_game_items_ResultItemId", column: x => x.ResultItemId, principalTable: "game_items", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_game_items_Category", table: "game_items", column: "Category"); migrationBuilder.CreateIndex( name: "IX_game_items_IsEnabled", table: "game_items", column: "IsEnabled"); migrationBuilder.CreateIndex( name: "IX_game_recipes_IsEnabled", table: "game_recipes", column: "IsEnabled"); migrationBuilder.CreateIndex( name: "IX_game_recipes_ResultItemId", table: "game_recipes", column: "ResultItemId"); migrationBuilder.CreateIndex( name: "IX_match_history_AccountId", table: "match_history", column: "AccountId"); migrationBuilder.CreateIndex( name: "IX_match_history_MatchId", table: "match_history", column: "MatchId"); migrationBuilder.CreateIndex( name: "IX_match_history_PlayedAt", table: "match_history", column: "PlayedAt"); migrationBuilder.CreateIndex( name: "IX_player_stats_AccountId", table: "player_stats", column: "AccountId", unique: true); } } }