using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SystemRevivalServer.Migrations { /// public partial class CreateDungeonAuthoringTables : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "tilemap_sheets", 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"), CdnPath = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Tags = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), SheetWidth = table.Column(type: "int", nullable: false), SheetHeight = table.Column(type: "int", nullable: false), TileWidth = table.Column(type: "int", nullable: false), TileHeight = table.Column(type: "int", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(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(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(512)", maxLength: 512, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Tags = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "int", nullable: false), Width = table.Column(type: "int", nullable: false), Height = table.Column(type: "int", nullable: false), MinTier = table.Column(type: "int", nullable: false), MaxTier = table.Column(type: "int", nullable: false), Weight = table.Column(type: "int", nullable: false), TileDataJson = table.Column(type: "json", nullable: true), SpawnPointsJson = table.Column(type: "json", nullable: true), ConnectionPointsJson = table.Column(type: "json", nullable: true), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(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(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(512)", maxLength: 512, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Tags = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Tier = table.Column(type: "int", nullable: false), Width = table.Column(type: "int", nullable: false), Height = table.Column(type: "int", nullable: false), IsHandCrafted = table.Column(type: "tinyint(1)", nullable: false), TileDataJson = table.Column(type: "json", nullable: true), RoomPlacementsJson = table.Column(type: "json", nullable: true), GenerationParamsJson = table.Column(type: "json", nullable: true), DefaultTileMapSheetId = table.Column(type: "int", nullable: true), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), TileMapSheetId = table.Column(type: "int", nullable: false), FrameIndex = table.Column(type: "int", nullable: false), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "int", nullable: false), Tags = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), IsWalkable = table.Column(type: "tinyint(1)", nullable: false), BlocksProjectiles = table.Column(type: "tinyint(1)", nullable: false), BlocksLineOfSight = table.Column(type: "tinyint(1)", nullable: false), RenderLayer = table.Column(type: "int", nullable: false), ZIndex = table.Column(type: "int", nullable: false), IsEnabled = table.Column(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"); } /// 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"); } } }