Files
systemrevivalserver/Migrations/20251226145940_Cleanup.cs
2025-12-26 10:00:34 -05:00

222 lines
12 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SystemRevivalServer.Migrations
{
/// <inheritdoc />
public partial class Cleanup : Migration
{
/// <inheritdoc />
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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "game_items",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
AmmoType = table.Column<int>(type: "int", nullable: false),
Category = table.Column<int>(type: "int", nullable: false),
CraftCost = table.Column<int>(type: "int", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"),
Damage = table.Column<int>(type: "int", nullable: false),
DamageReduction = table.Column<float>(type: "float", nullable: false),
DashCooldown = table.Column<float>(type: "float", nullable: false),
DashDistance = table.Column<float>(type: "float", nullable: false),
Description = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ExplosionRadius = table.Column<float>(type: "float", nullable: false),
FireRate = table.Column<float>(type: "float", nullable: false),
HarvestMultiplier = table.Column<float>(type: "float", nullable: false),
HealAmount = table.Column<int>(type: "int", nullable: false),
HealthBonus = table.Column<int>(type: "int", nullable: false),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
LootValue = table.Column<int>(type: "int", nullable: false),
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
PelletCount = table.Column<int>(type: "int", nullable: false),
ProjectileSpeed = table.Column<float>(type: "float", nullable: false),
Range = table.Column<float>(type: "float", nullable: false),
ScanCooldown = table.Column<float>(type: "float", nullable: false),
ScanRadius = table.Column<float>(type: "float", nullable: false),
ShieldBoostDuration = table.Column<float>(type: "float", nullable: false),
ShieldDuration = table.Column<float>(type: "float", nullable: false),
ShieldHealth = table.Column<int>(type: "int", nullable: false),
SpeedBoostDuration = table.Column<float>(type: "float", nullable: false),
SpeedMultiplier = table.Column<float>(type: "float", nullable: false),
SpeedPenalty = table.Column<float>(type: "float", nullable: false),
Spread = table.Column<float>(type: "float", nullable: false),
Stackable = table.Column<bool>(type: "tinyint(1)", nullable: false),
UpdatedAt = table.Column<DateTime>(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<ulong>(type: "bigint unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
AccountId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
DamageDealt = table.Column<int>(type: "int", nullable: false),
DamageTaken = table.Column<int>(type: "int", nullable: false),
Deaths = table.Column<int>(type: "int", nullable: false),
EloAfter = table.Column<int>(type: "int", nullable: false),
EloChange = table.Column<int>(type: "int", nullable: false),
EnergyCollected = table.Column<int>(type: "int", nullable: false),
ItemsCrafted = table.Column<int>(type: "int", nullable: false),
Kills = table.Column<int>(type: "int", nullable: false),
MatchDurationSeconds = table.Column<int>(type: "int", nullable: false),
MatchId = table.Column<string>(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Placement = table.Column<int>(type: "int", nullable: false),
PlayedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"),
RareCollected = table.Column<int>(type: "int", nullable: false),
Result = table.Column<int>(type: "int", nullable: false),
ScrapCollected = table.Column<int>(type: "int", nullable: false),
SurvivalTimeSeconds = table.Column<int>(type: "int", nullable: false),
TotalPlayers = table.Column<int>(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<ulong>(type: "bigint unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
AccountId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"),
Deaths = table.Column<int>(type: "int", nullable: false),
Elo = table.Column<int>(type: "int", nullable: false, defaultValue: 1000),
Extractions = table.Column<int>(type: "int", nullable: false),
ItemsCrafted = table.Column<int>(type: "int", nullable: false),
Kills = table.Column<int>(type: "int", nullable: false),
LongestSurvivalSeconds = table.Column<int>(type: "int", nullable: false),
Losses = table.Column<int>(type: "int", nullable: false),
MatchesPlayed = table.Column<int>(type: "int", nullable: false),
TotalDamageDealt = table.Column<long>(type: "bigint", nullable: false),
TotalDamageTaken = table.Column<long>(type: "bigint", nullable: false),
TotalEnergyCollected = table.Column<long>(type: "bigint", nullable: false),
TotalPlayTimeSeconds = table.Column<long>(type: "bigint", nullable: false),
TotalRareCollected = table.Column<long>(type: "bigint", nullable: false),
TotalScrapCollected = table.Column<long>(type: "bigint", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn),
Wins = table.Column<int>(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<int>(type: "int", nullable: false),
ResultItemId = table.Column<int>(type: "int", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"),
EnergyCost = table.Column<int>(type: "int", nullable: false),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
RareCost = table.Column<int>(type: "int", nullable: false),
ScrapCost = table.Column<int>(type: "int", nullable: false),
UpdatedAt = table.Column<DateTime>(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);
}
}
}