137 lines
5.1 KiB
C#
137 lines
5.1 KiB
C#
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SystemRevivalServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class worldCords : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "WorldChunkX",
|
|
table: "dungeon_characters",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "WorldChunkY",
|
|
table: "dungeon_characters",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "WorldRegionId",
|
|
table: "dungeon_characters",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<float>(
|
|
name: "WorldX",
|
|
table: "dungeon_characters",
|
|
type: "float",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<float>(
|
|
name: "WorldY",
|
|
table: "dungeon_characters",
|
|
type: "float",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "WorldZoneX",
|
|
table: "dungeon_characters",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "WorldZoneY",
|
|
table: "dungeon_characters",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "world_chunk_mob_spawns",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
WorldChunkId = table.Column<long>(type: "bigint", nullable: false),
|
|
MobDefinitionId = table.Column<int>(type: "int", nullable: false),
|
|
TileX = table.Column<int>(type: "int", nullable: false),
|
|
TileY = table.Column<int>(type: "int", nullable: false),
|
|
Rotation = table.Column<int>(type: "int", nullable: false),
|
|
SpawnCount = table.Column<int>(type: "int", nullable: false),
|
|
RespawnSeconds = table.Column<float>(type: "float", nullable: false),
|
|
MetadataJson = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_world_chunk_mob_spawns", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_world_chunk_mob_spawns_dungeon_mob_definitions_MobDefinition~",
|
|
column: x => x.MobDefinitionId,
|
|
principalTable: "dungeon_mob_definitions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_world_chunk_mob_spawns_world_chunks_WorldChunkId",
|
|
column: x => x.WorldChunkId,
|
|
principalTable: "world_chunks",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_world_chunk_mob_spawns_MobDefinitionId",
|
|
table: "world_chunk_mob_spawns",
|
|
column: "MobDefinitionId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_world_chunk_mob_spawns_WorldChunkId_TileX_TileY_MobDefinitio~",
|
|
table: "world_chunk_mob_spawns",
|
|
columns: new[] { "WorldChunkId", "TileX", "TileY", "MobDefinitionId" });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "world_chunk_mob_spawns");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WorldChunkX",
|
|
table: "dungeon_characters");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WorldChunkY",
|
|
table: "dungeon_characters");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WorldRegionId",
|
|
table: "dungeon_characters");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WorldX",
|
|
table: "dungeon_characters");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WorldY",
|
|
table: "dungeon_characters");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WorldZoneX",
|
|
table: "dungeon_characters");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WorldZoneY",
|
|
table: "dungeon_characters");
|
|
}
|
|
}
|
|
}
|