Files
systemrevivalserver/Migrations/20251228011218_Admin Tools for Sprites.cs
T
2025-12-27 20:12:40 -05:00

163 lines
8.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SystemRevivalServer.Migrations
{
/// <inheritdoc />
public partial class AdminToolsforSprites : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "mob_ability_animation_mappings",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
AbilityAssignmentId = table.Column<int>(type: "int", nullable: false),
AnimationKey = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
DirectionSuffix = table.Column<string>(type: "varchar(16)", maxLength: 16, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_mob_ability_animation_mappings", x => x.Id);
table.ForeignKey(
name: "FK_mob_ability_animation_mappings_dungeon_mob_ability_assignmen~",
column: x => x.AbilityAssignmentId,
principalTable: "dungeon_mob_ability_assignments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "mob_sprite_sheets",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CdnPath = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SheetWidth = table.Column<int>(type: "int", nullable: false),
SheetHeight = table.Column<int>(type: "int", nullable: false),
FrameWidth = table.Column<int>(type: "int", nullable: false),
FrameHeight = table.Column<int>(type: "int", nullable: false),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_mob_sprite_sheets", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "mob_animation_definitions",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
SpriteSheetId = table.Column<int>(type: "int", nullable: false),
Key = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
FrameSequence = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Fps = table.Column<float>(type: "float", nullable: false),
Loop = table.Column<bool>(type: "tinyint(1)", nullable: false),
FlipX = table.Column<bool>(type: "tinyint(1)", nullable: false),
FlipY = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_mob_animation_definitions", x => x.Id);
table.ForeignKey(
name: "FK_mob_animation_definitions_mob_sprite_sheets_SpriteSheetId",
column: x => x.SpriteSheetId,
principalTable: "mob_sprite_sheets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "mob_animation_assignments",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
MobDefinitionId = table.Column<int>(type: "int", nullable: false),
AnimationDefinitionId = table.Column<int>(type: "int", nullable: false),
OverrideKey = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Priority = table.Column<int>(type: "int", nullable: false),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_mob_animation_assignments", x => x.Id);
table.ForeignKey(
name: "FK_mob_animation_assignments_dungeon_mob_definitions_MobDefinit~",
column: x => x.MobDefinitionId,
principalTable: "dungeon_mob_definitions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_mob_animation_assignments_mob_animation_definitions_Animatio~",
column: x => x.AnimationDefinitionId,
principalTable: "mob_animation_definitions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_mob_ability_animation_mappings_AbilityAssignmentId",
table: "mob_ability_animation_mappings",
column: "AbilityAssignmentId");
migrationBuilder.CreateIndex(
name: "IX_mob_animation_assignments_AnimationDefinitionId",
table: "mob_animation_assignments",
column: "AnimationDefinitionId");
migrationBuilder.CreateIndex(
name: "IX_mob_animation_assignments_MobDefinitionId",
table: "mob_animation_assignments",
column: "MobDefinitionId");
migrationBuilder.CreateIndex(
name: "IX_mob_animation_definitions_SpriteSheetId",
table: "mob_animation_definitions",
column: "SpriteSheetId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "mob_ability_animation_mappings");
migrationBuilder.DropTable(
name: "mob_animation_assignments");
migrationBuilder.DropTable(
name: "mob_animation_definitions");
migrationBuilder.DropTable(
name: "mob_sprite_sheets");
}
}
}