208 lines
9.2 KiB
C#
208 lines
9.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SystemRevivalServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class CreateDungeonAuthoringTables : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "tilemap_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"),
|
|
|
|
Tags = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
|
|
SheetWidth = table.Column<int>(type: "int", nullable: false),
|
|
SheetHeight = table.Column<int>(type: "int", nullable: false),
|
|
|
|
TileWidth = table.Column<int>(type: "int", nullable: false),
|
|
TileHeight = 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_tilemap_sheets", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "room_templates",
|
|
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"),
|
|
|
|
Description = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
|
|
Tags = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
|
|
Type = table.Column<int>(type: "int", nullable: false),
|
|
|
|
Width = table.Column<int>(type: "int", nullable: false),
|
|
Height = table.Column<int>(type: "int", nullable: false),
|
|
|
|
MinTier = table.Column<int>(type: "int", nullable: false),
|
|
MaxTier = table.Column<int>(type: "int", nullable: false),
|
|
|
|
Weight = table.Column<int>(type: "int", nullable: false),
|
|
|
|
TileDataJson = table.Column<string>(type: "json", nullable: true),
|
|
SpawnPointsJson = table.Column<string>(type: "json", nullable: true),
|
|
ConnectionPointsJson = table.Column<string>(type: "json", nullable: true),
|
|
|
|
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_room_templates", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "dungeon_templates",
|
|
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"),
|
|
|
|
Description = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
|
|
Tags = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
|
|
Tier = table.Column<int>(type: "int", nullable: false),
|
|
|
|
Width = table.Column<int>(type: "int", nullable: false),
|
|
Height = table.Column<int>(type: "int", nullable: false),
|
|
|
|
IsHandCrafted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
|
|
TileDataJson = table.Column<string>(type: "json", nullable: true),
|
|
RoomPlacementsJson = table.Column<string>(type: "json", nullable: true),
|
|
GenerationParamsJson = table.Column<string>(type: "json", nullable: true),
|
|
|
|
DefaultTileMapSheetId = table.Column<int>(type: "int", nullable: true),
|
|
|
|
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_dungeon_templates", x => x.Id);
|
|
|
|
table.ForeignKey(
|
|
name: "FK_dungeon_templates_tilemap_sheets_DefaultTileMapSheetId",
|
|
column: x => x.DefaultTileMapSheetId,
|
|
principalTable: "tilemap_sheets",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_dungeon_templates_DefaultTileMapSheetId",
|
|
table: "dungeon_templates",
|
|
column: "DefaultTileMapSheetId");
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "tile_definitions",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
|
|
TileMapSheetId = table.Column<int>(type: "int", nullable: false),
|
|
|
|
FrameIndex = table.Column<int>(type: "int", nullable: false),
|
|
|
|
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
|
|
Type = table.Column<int>(type: "int", nullable: false),
|
|
|
|
Tags = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
|
|
IsWalkable = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
BlocksProjectiles = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
BlocksLineOfSight = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
|
|
RenderLayer = table.Column<int>(type: "int", nullable: false),
|
|
ZIndex = table.Column<int>(type: "int", nullable: false),
|
|
|
|
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_tile_definitions", x => x.Id);
|
|
|
|
table.ForeignKey(
|
|
name: "FK_tile_definitions_tilemap_sheets_TileMapSheetId",
|
|
column: x => x.TileMapSheetId,
|
|
principalTable: "tilemap_sheets",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_tile_definitions_TileMapSheetId",
|
|
table: "tile_definitions",
|
|
column: "TileMapSheetId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "tile_definitions");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "dungeon_templates");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "room_templates");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "tilemap_sheets");
|
|
}
|
|
}
|
|
}
|