using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SystemRevivalServer.Migrations { /// public partial class Initialize : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "accounts", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Username = table.Column(type: "varchar(32)", maxLength: 32, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Email = table.Column(type: "varchar(255)", maxLength: 255, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), PasswordHash = table.Column(type: "varbinary(64)", nullable: false), PasswordSalt = table.Column(type: "varbinary(32)", nullable: false), IsBanned = table.Column(type: "tinyint(1)", nullable: false), BannedUntil = table.Column(type: "datetime(6)", nullable: true), Role = table.Column(type: "int", nullable: false, defaultValue: 0), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) }, constraints: table => { table.PrimaryKey("PK_accounts", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_item_definitions", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "int", nullable: false), Rarity = table.Column(type: "int", nullable: false), EquipSlot = table.Column(type: "int", nullable: true), RequiredStrength = table.Column(type: "int", nullable: false), RequiredIntelligence = table.Column(type: "int", nullable: false), RequiredWisdom = table.Column(type: "int", nullable: false), RequiredDexterity = table.Column(type: "int", nullable: false), RequiredLevel = table.Column(type: "int", nullable: false), BonusStrength = table.Column(type: "int", nullable: false), BonusIntelligence = table.Column(type: "int", nullable: false), BonusWisdom = table.Column(type: "int", nullable: false), BonusEndurance = table.Column(type: "int", nullable: false), BonusDexterity = table.Column(type: "int", nullable: false), BonusHealth = table.Column(type: "int", nullable: false), BonusMana = table.Column(type: "int", nullable: false), MinDamage = table.Column(type: "int", nullable: false), MaxDamage = table.Column(type: "int", nullable: false), AttackRange = table.Column(type: "float", nullable: false), DamageType = table.Column(type: "int", nullable: false), Armor = table.Column(type: "int", nullable: false), MagicResist = table.Column(type: "int", nullable: false), HealAmount = table.Column(type: "int", nullable: false), ManaRestore = table.Column(type: "int", nullable: false), StaminaRestore = table.Column(type: "int", nullable: false), IsTeleportScroll = table.Column(type: "tinyint(1)", nullable: false), TeachesSpellId = table.Column(type: "int", nullable: true), Stackable = table.Column(type: "tinyint(1)", nullable: false), MaxStack = table.Column(type: "int", nullable: false), SpriteId = table.Column(type: "int", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_item_definitions", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_loot_tables", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), MinTier = table.Column(type: "int", nullable: false), MaxTier = table.Column(type: "int", nullable: false), DropChanceMultiplier = table.Column(type: "float", nullable: false), MinDrops = table.Column(type: "int", nullable: false), MaxDrops = table.Column(type: "int", nullable: false), GuaranteedDrop = table.Column(type: "tinyint(1)", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_loot_tables", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_mob_definitions", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "int", nullable: false), Category = table.Column(type: "int", nullable: false), MinTier = table.Column(type: "int", nullable: false), MaxTier = table.Column(type: "int", nullable: false), BaseHealth = table.Column(type: "int", nullable: false), BaseMana = table.Column(type: "int", nullable: false), BasePhysicalDamage = table.Column(type: "int", nullable: false), BaseMagicDamage = table.Column(type: "int", nullable: false), BaseArmor = table.Column(type: "int", nullable: false), BaseMagicResist = table.Column(type: "int", nullable: false), MoveSpeed = table.Column(type: "float", nullable: false), AttackRange = table.Column(type: "float", nullable: false), AttackSpeed = table.Column(type: "float", nullable: false), AggroRange = table.Column(type: "float", nullable: false), LeashRange = table.Column(type: "float", nullable: false), HealthPerTier = table.Column(type: "float", nullable: false), DamagePerTier = table.Column(type: "float", nullable: false), ArmorPerTier = table.Column(type: "float", nullable: false), BaseXp = table.Column(type: "int", nullable: false), XpPerTier = table.Column(type: "float", nullable: false), LootTableId = table.Column(type: "int", nullable: false), DropChanceMultiplier = table.Column(type: "float", nullable: false), ResistancesJson = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), AbilitiesJson = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), SpriteSheet = table.Column(type: "varchar(128)", maxLength: 128, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), SpriteIndex = table.Column(type: "int", nullable: false), SpriteWidth = table.Column(type: "int", nullable: false), SpriteHeight = table.Column(type: "int", nullable: false), TintColor = table.Column(type: "varchar(16)", maxLength: 16, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), IdleFrames = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), WalkFrames = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), AttackFrames = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), DeathFrames = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), AnimationSpeed = table.Column(type: "float", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_mob_definitions", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_spell_definitions", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "int", nullable: false), RequiredWisdom = table.Column(type: "int", nullable: false), RequiredIntelligence = table.Column(type: "int", nullable: false), RequiredLevel = table.Column(type: "int", nullable: false), ManaCost = table.Column(type: "int", nullable: false), Cooldown = table.Column(type: "float", nullable: false), BaseDamage = table.Column(type: "int", nullable: false), BaseHealing = table.Column(type: "int", nullable: false), Range = table.Column(type: "float", nullable: false), AreaOfEffect = table.Column(type: "float", nullable: false), IsTeleport = table.Column(type: "tinyint(1)", nullable: false), IsShield = table.Column(type: "tinyint(1)", nullable: false), ShieldAmount = table.Column(type: "int", nullable: false), SpriteId = table.Column(type: "int", nullable: false), EffectColor = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), IsEnabled = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_spell_definitions", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "game_items", columns: table => new { Id = table.Column(type: "int", nullable: false), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Category = table.Column(type: "int", nullable: false), CraftCost = table.Column(type: "int", nullable: false), Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), LootValue = table.Column(type: "int", nullable: false), Stackable = table.Column(type: "tinyint(1)", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), Damage = table.Column(type: "int", nullable: false), FireRate = table.Column(type: "float", nullable: false), ProjectileSpeed = table.Column(type: "float", nullable: false), Range = table.Column(type: "float", nullable: false), AmmoType = table.Column(type: "int", nullable: false), PelletCount = table.Column(type: "int", nullable: false), Spread = table.Column(type: "float", nullable: false), ExplosionRadius = table.Column(type: "float", nullable: false), HarvestMultiplier = table.Column(type: "float", nullable: false), ScanRadius = table.Column(type: "float", nullable: false), ScanCooldown = table.Column(type: "float", nullable: false), ShieldHealth = table.Column(type: "int", nullable: false), ShieldDuration = table.Column(type: "float", nullable: false), HealAmount = table.Column(type: "int", nullable: false), ShieldBoostDuration = table.Column(type: "float", nullable: false), DamageReduction = table.Column(type: "float", nullable: false), SpeedBoostDuration = table.Column(type: "float", nullable: false), SpeedMultiplier = table.Column(type: "float", nullable: false), HealthBonus = table.Column(type: "int", nullable: false), SpeedPenalty = table.Column(type: "float", nullable: false), DashDistance = table.Column(type: "float", nullable: false), DashCooldown = table.Column(type: "float", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), 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: "item_templates", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ItemType = table.Column(type: "tinyint unsigned", nullable: false), Rarity = table.Column(type: "tinyint unsigned", nullable: false), MaxStack = table.Column(type: "int unsigned", nullable: false), Weight = table.Column(type: "int unsigned", nullable: false), StatsJson = table.Column(type: "json", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) }, constraints: table => { table.PrimaryKey("PK_item_templates", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "zones", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), MinX = table.Column(type: "double", nullable: false), MinY = table.Column(type: "double", nullable: false), MinZ = table.Column(type: "double", nullable: false), MaxX = table.Column(type: "double", nullable: false), MaxY = table.Column(type: "double", nullable: false), MaxZ = table.Column(type: "double", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) }, constraints: table => { table.PrimaryKey("PK_zones", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_characters", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), AccountId = table.Column(type: "bigint unsigned", nullable: false), Name = table.Column(type: "varchar(32)", maxLength: 32, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), CreatedAt = table.Column(type: "datetime(6)", nullable: false), LastPlayedAt = table.Column(type: "datetime(6)", nullable: false), Level = table.Column(type: "int", nullable: false), Experience = table.Column(type: "bigint", nullable: false), UnspentStatPoints = table.Column(type: "int", nullable: false), Strength = table.Column(type: "int", nullable: false), Intelligence = table.Column(type: "int", nullable: false), Wisdom = table.Column(type: "int", nullable: false), Endurance = table.Column(type: "int", nullable: false), Dexterity = table.Column(type: "int", nullable: false), CurrentHealth = table.Column(type: "int", nullable: false), CurrentMana = table.Column(type: "int", nullable: false), EquippedWeapon = table.Column(type: "bigint unsigned", nullable: true), EquippedOffhand = table.Column(type: "bigint unsigned", nullable: true), EquippedHead = table.Column(type: "bigint unsigned", nullable: true), EquippedChest = table.Column(type: "bigint unsigned", nullable: true), EquippedLegs = table.Column(type: "bigint unsigned", nullable: true), EquippedBoots = table.Column(type: "bigint unsigned", nullable: true), EquippedGloves = table.Column(type: "bigint unsigned", nullable: true), EquippedAccessory = table.Column(type: "bigint unsigned", nullable: true), TotalKills = table.Column(type: "int", nullable: false), TotalDeaths = table.Column(type: "int", nullable: false), PlayersKilled = table.Column(type: "int", nullable: false), DungeonsCompleted = table.Column(type: "int", nullable: false), BossesKilled = table.Column(type: "int", nullable: false), IsDeleted = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_characters", x => x.Id); table.ForeignKey( name: "FK_dungeon_characters_accounts_AccountId", column: x => x.AccountId, principalTable: "accounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .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), MatchId = table.Column(type: "varchar(32)", maxLength: 32, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), AccountId = table.Column(type: "bigint unsigned", nullable: false), Result = table.Column(type: "int", nullable: false), Placement = table.Column(type: "int", nullable: false), TotalPlayers = table.Column(type: "int", nullable: false), Kills = table.Column(type: "int", nullable: false), Deaths = table.Column(type: "int", nullable: false), DamageDealt = table.Column(type: "int", nullable: false), DamageTaken = table.Column(type: "int", nullable: false), ScrapCollected = table.Column(type: "int", nullable: false), EnergyCollected = table.Column(type: "int", nullable: false), RareCollected = table.Column(type: "int", nullable: false), ItemsCrafted = table.Column(type: "int", nullable: false), SurvivalTimeSeconds = table.Column(type: "int", nullable: false), MatchDurationSeconds = table.Column(type: "int", nullable: false), EloChange = table.Column(type: "int", nullable: false), EloAfter = table.Column(type: "int", nullable: false), PlayedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") }, 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), MatchesPlayed = table.Column(type: "int", nullable: false), Wins = table.Column(type: "int", nullable: false), Losses = table.Column(type: "int", nullable: false), Extractions = table.Column(type: "int", nullable: false), Kills = table.Column(type: "int", nullable: false), Deaths = table.Column(type: "int", nullable: false), TotalDamageDealt = table.Column(type: "bigint", nullable: false), TotalDamageTaken = table.Column(type: "bigint", nullable: false), TotalScrapCollected = table.Column(type: "bigint", nullable: false), TotalEnergyCollected = table.Column(type: "bigint", nullable: false), TotalRareCollected = table.Column(type: "bigint", nullable: false), ItemsCrafted = table.Column(type: "int", nullable: false), TotalPlayTimeSeconds = table.Column(type: "bigint", nullable: false), LongestSurvivalSeconds = table.Column(type: "int", nullable: false), Elo = table.Column(type: "int", nullable: false, defaultValue: 1000), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) }, 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: "sessions", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), AccountId = table.Column(type: "bigint unsigned", nullable: false), TokenHash = table.Column(type: "varchar(128)", maxLength: 128, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ExpiresAt = table.Column(type: "datetime(6)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), CreatedIp = table.Column(type: "varchar(64)", maxLength: 64, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), UserAgent = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), RevokedAt = table.Column(type: "datetime(6)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_sessions", x => x.Id); table.ForeignKey( name: "FK_sessions_accounts_AccountId", column: x => x.AccountId, principalTable: "accounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_loot_table_entries", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), LootTableId = table.Column(type: "int", nullable: false), ItemDefinitionId = table.Column(type: "int", nullable: false), DropChance = table.Column(type: "float", nullable: false), MinQuantity = table.Column(type: "int", nullable: false), MaxQuantity = table.Column(type: "int", nullable: false), Weight = table.Column(type: "int", nullable: false), Guaranteed = table.Column(type: "tinyint(1)", nullable: false), DropChancePerTier = table.Column(type: "float", nullable: false), MaxDropChance = table.Column(type: "float", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_loot_table_entries", x => x.Id); table.ForeignKey( name: "FK_dungeon_loot_table_entries_dungeon_item_definitions_ItemDefi~", column: x => x.ItemDefinitionId, principalTable: "dungeon_item_definitions", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_dungeon_loot_table_entries_dungeon_loot_tables_LootTableId", column: x => x.LootTableId, principalTable: "dungeon_loot_tables", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_mob_loot_tables", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), MobDefinitionId = table.Column(type: "int", nullable: false), LootTableId = table.Column(type: "int", nullable: false), Priority = table.Column(type: "int", nullable: false), RollChance = table.Column(type: "float", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_mob_loot_tables", x => x.Id); table.ForeignKey( name: "FK_dungeon_mob_loot_tables_dungeon_loot_tables_LootTableId", column: x => x.LootTableId, principalTable: "dungeon_loot_tables", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_dungeon_mob_loot_tables_dungeon_mob_definitions_MobDefinitio~", column: x => x.MobDefinitionId, principalTable: "dungeon_mob_definitions", 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), IsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), ScrapCost = table.Column(type: "int", nullable: false), EnergyCost = table.Column(type: "int", nullable: false), RareCost = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), 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.CreateTable( name: "characters", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), AccountId = table.Column(type: "bigint unsigned", nullable: false), Name = table.Column(type: "varchar(32)", maxLength: 32, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Level = table.Column(type: "int unsigned", nullable: false), Xp = table.Column(type: "bigint unsigned", nullable: false), StatStrength = table.Column(type: "int unsigned", nullable: false), StatDexterity = table.Column(type: "int unsigned", nullable: false), StatWisdom = table.Column(type: "int unsigned", nullable: false), StatIntelligence = table.Column(type: "int unsigned", nullable: false), StatEndurance = table.Column(type: "int unsigned", nullable: false), HpCurrent = table.Column(type: "int unsigned", nullable: false), HpMax = table.Column(type: "int unsigned", nullable: false), MpCurrent = table.Column(type: "int unsigned", nullable: false), MpMax = table.Column(type: "int unsigned", nullable: false), StaminaCurrent = table.Column(type: "int unsigned", nullable: false), StaminaMax = table.Column(type: "int unsigned", nullable: false), ZoneId = table.Column(type: "bigint unsigned", nullable: false), PosX = table.Column(type: "double", nullable: false), PosY = table.Column(type: "double", nullable: false), PosZ = table.Column(type: "double", nullable: false), FacingDeg = table.Column(type: "float", nullable: false), AppearanceJson = table.Column(type: "json", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) }, constraints: table => { table.PrimaryKey("PK_characters", x => x.Id); table.ForeignKey( name: "FK_characters_accounts_AccountId", column: x => x.AccountId, principalTable: "accounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_characters_zones_ZoneId", column: x => x.ZoneId, principalTable: "zones", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_character_items", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CharacterId = table.Column(type: "bigint unsigned", nullable: false), ItemDefinitionId = table.Column(type: "int", nullable: false), Quantity = table.Column(type: "int", nullable: false), SlotIndex = table.Column(type: "int", nullable: false), IsEquipped = table.Column(type: "tinyint(1)", nullable: false), EquipSlot = table.Column(type: "int", nullable: true), AcquiredAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_character_items", x => x.Id); table.ForeignKey( name: "FK_dungeon_character_items_dungeon_characters_CharacterId", column: x => x.CharacterId, principalTable: "dungeon_characters", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_dungeon_character_items_dungeon_item_definitions_ItemDefinit~", column: x => x.ItemDefinitionId, principalTable: "dungeon_item_definitions", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_learned_spells", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CharacterId = table.Column(type: "bigint unsigned", nullable: false), SpellDefinitionId = table.Column(type: "int", nullable: false), LearnedAt = table.Column(type: "datetime(6)", nullable: false), SpellLevel = table.Column(type: "int", nullable: false), DefinitionId = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_dungeon_learned_spells", x => x.Id); table.ForeignKey( name: "FK_dungeon_learned_spells_dungeon_characters_CharacterId", column: x => x.CharacterId, principalTable: "dungeon_characters", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_dungeon_learned_spells_dungeon_spell_definitions_DefinitionId", column: x => x.DefinitionId, principalTable: "dungeon_spell_definitions", principalColumn: "Id"); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_stash_items", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CharacterId = table.Column(type: "bigint unsigned", nullable: false), ItemDefinitionId = table.Column(type: "int", nullable: false), Quantity = table.Column(type: "int", nullable: false), SlotIndex = table.Column(type: "int", nullable: false), StoredAt = table.Column(type: "datetime(6)", nullable: false), DefinitionId = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_dungeon_stash_items", x => x.Id); table.ForeignKey( name: "FK_dungeon_stash_items_dungeon_characters_CharacterId", column: x => x.CharacterId, principalTable: "dungeon_characters", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_dungeon_stash_items_dungeon_item_definitions_DefinitionId", column: x => x.DefinitionId, principalTable: "dungeon_item_definitions", principalColumn: "Id"); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "equipment", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CharacterId = table.Column(type: "bigint unsigned", nullable: false), SlotCode = table.Column(type: "tinyint unsigned", nullable: false), ItemTemplateId = table.Column(type: "bigint unsigned", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) }, constraints: table => { table.PrimaryKey("PK_equipment", x => x.Id); table.ForeignKey( name: "FK_equipment_characters_CharacterId", column: x => x.CharacterId, principalTable: "characters", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_equipment_item_templates_ItemTemplateId", column: x => x.ItemTemplateId, principalTable: "item_templates", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "inventories", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CharacterId = table.Column(type: "bigint unsigned", nullable: false), SlotIndex = table.Column(type: "int unsigned", nullable: false), ItemTemplateId = table.Column(type: "bigint unsigned", nullable: false), Quantity = table.Column(type: "int unsigned", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn) }, constraints: table => { table.PrimaryKey("PK_inventories", x => x.Id); table.ForeignKey( name: "FK_inventories_characters_CharacterId", column: x => x.CharacterId, principalTable: "characters", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_inventories_item_templates_ItemTemplateId", column: x => x.ItemTemplateId, principalTable: "item_templates", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_accounts_Email", table: "accounts", column: "Email", unique: true); migrationBuilder.CreateIndex( name: "IX_accounts_Username", table: "accounts", column: "Username", unique: true); migrationBuilder.CreateIndex( name: "IX_characters_AccountId", table: "characters", column: "AccountId", unique: true); migrationBuilder.CreateIndex( name: "IX_characters_ZoneId", table: "characters", column: "ZoneId"); migrationBuilder.CreateIndex( name: "IX_dungeon_character_items_CharacterId", table: "dungeon_character_items", column: "CharacterId"); migrationBuilder.CreateIndex( name: "IX_dungeon_character_items_ItemDefinitionId", table: "dungeon_character_items", column: "ItemDefinitionId"); migrationBuilder.CreateIndex( name: "IX_dungeon_characters_AccountId", table: "dungeon_characters", column: "AccountId"); migrationBuilder.CreateIndex( name: "IX_dungeon_learned_spells_CharacterId", table: "dungeon_learned_spells", column: "CharacterId"); migrationBuilder.CreateIndex( name: "IX_dungeon_learned_spells_DefinitionId", table: "dungeon_learned_spells", column: "DefinitionId"); migrationBuilder.CreateIndex( name: "IX_dungeon_loot_table_entries_ItemDefinitionId", table: "dungeon_loot_table_entries", column: "ItemDefinitionId"); migrationBuilder.CreateIndex( name: "IX_dungeon_loot_table_entries_LootTableId", table: "dungeon_loot_table_entries", column: "LootTableId"); migrationBuilder.CreateIndex( name: "IX_dungeon_mob_loot_tables_LootTableId", table: "dungeon_mob_loot_tables", column: "LootTableId"); migrationBuilder.CreateIndex( name: "IX_dungeon_mob_loot_tables_MobDefinitionId", table: "dungeon_mob_loot_tables", column: "MobDefinitionId"); migrationBuilder.CreateIndex( name: "IX_dungeon_stash_items_CharacterId", table: "dungeon_stash_items", column: "CharacterId"); migrationBuilder.CreateIndex( name: "IX_dungeon_stash_items_DefinitionId", table: "dungeon_stash_items", column: "DefinitionId"); migrationBuilder.CreateIndex( name: "IX_equipment_CharacterId_SlotCode", table: "equipment", columns: new[] { "CharacterId", "SlotCode" }, unique: true); migrationBuilder.CreateIndex( name: "IX_equipment_ItemTemplateId", table: "equipment", column: "ItemTemplateId"); 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_inventories_CharacterId", table: "inventories", column: "CharacterId"); migrationBuilder.CreateIndex( name: "IX_inventories_CharacterId_SlotIndex", table: "inventories", columns: new[] { "CharacterId", "SlotIndex" }, unique: true); migrationBuilder.CreateIndex( name: "IX_inventories_ItemTemplateId", table: "inventories", column: "ItemTemplateId"); migrationBuilder.CreateIndex( name: "IX_item_templates_Name", table: "item_templates", column: "Name", unique: true); 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); migrationBuilder.CreateIndex( name: "IX_sessions_AccountId", table: "sessions", column: "AccountId"); migrationBuilder.CreateIndex( name: "IX_sessions_TokenHash", table: "sessions", column: "TokenHash", unique: true); migrationBuilder.CreateIndex( name: "IX_zones_Name", table: "zones", column: "Name", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "dungeon_character_items"); migrationBuilder.DropTable( name: "dungeon_learned_spells"); migrationBuilder.DropTable( name: "dungeon_loot_table_entries"); migrationBuilder.DropTable( name: "dungeon_mob_loot_tables"); migrationBuilder.DropTable( name: "dungeon_stash_items"); migrationBuilder.DropTable( name: "equipment"); migrationBuilder.DropTable( name: "game_recipes"); migrationBuilder.DropTable( name: "inventories"); migrationBuilder.DropTable( name: "match_history"); migrationBuilder.DropTable( name: "player_stats"); migrationBuilder.DropTable( name: "sessions"); migrationBuilder.DropTable( name: "dungeon_spell_definitions"); migrationBuilder.DropTable( name: "dungeon_loot_tables"); migrationBuilder.DropTable( name: "dungeon_mob_definitions"); migrationBuilder.DropTable( name: "dungeon_characters"); migrationBuilder.DropTable( name: "dungeon_item_definitions"); migrationBuilder.DropTable( name: "game_items"); migrationBuilder.DropTable( name: "characters"); migrationBuilder.DropTable( name: "item_templates"); migrationBuilder.DropTable( name: "accounts"); migrationBuilder.DropTable( name: "zones"); } } }