using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SystemRevivalServer.Migrations { /// public partial class Cleanupunusedcode : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "equipment"); migrationBuilder.DropTable( name: "inventories"); migrationBuilder.DropTable( name: "characters"); migrationBuilder.DropTable( name: "item_templates"); } /// protected override void Down(MigrationBuilder migrationBuilder) { 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), ZoneId = table.Column(type: "bigint unsigned", 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)"), FacingDeg = table.Column(type: "float", nullable: false), HpCurrent = table.Column(type: "int unsigned", nullable: false), HpMax = table.Column(type: "int unsigned", nullable: false), Level = table.Column(type: "int unsigned", nullable: false), MpCurrent = table.Column(type: "int unsigned", nullable: false), MpMax = table.Column(type: "int unsigned", nullable: false), Name = table.Column(type: "varchar(32)", maxLength: 32, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), PosX = table.Column(type: "double", nullable: false), PosY = table.Column(type: "double", nullable: false), PosZ = table.Column(type: "double", nullable: false), StaminaCurrent = table.Column(type: "int unsigned", nullable: false), StaminaMax = table.Column(type: "int unsigned", nullable: false), StatDexterity = table.Column(type: "int unsigned", nullable: false), StatEndurance = table.Column(type: "int unsigned", nullable: false), StatIntelligence = table.Column(type: "int unsigned", nullable: false), StatStrength = table.Column(type: "int unsigned", nullable: false), StatWisdom = table.Column(type: "int unsigned", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn), Xp = table.Column(type: "bigint unsigned", nullable: false) }, 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: "item_templates", columns: table => new { Id = table.Column(type: "bigint unsigned", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), ItemType = table.Column(type: "tinyint unsigned", nullable: false), MaxStack = table.Column(type: "int unsigned", nullable: false), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Rarity = table.Column(type: "tinyint unsigned", nullable: false), StatsJson = table.Column(type: "json", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), UpdatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)") .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn), Weight = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_item_templates", x => x.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), ItemTemplateId = table.Column(type: "bigint unsigned", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), SlotCode = table.Column(type: "tinyint unsigned", nullable: false), 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), ItemTemplateId = table.Column(type: "bigint unsigned", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"), Quantity = table.Column(type: "int unsigned", nullable: false), SlotIndex = table.Column(type: "int unsigned", nullable: false), 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_characters_AccountId", table: "characters", column: "AccountId", unique: true); migrationBuilder.CreateIndex( name: "IX_characters_ZoneId", table: "characters", column: "ZoneId"); 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_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); } } }