using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SystemRevivalServer.Migrations
{
///
public partial class BuilderChanges : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "IsInteractable",
table: "tile_definitions",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn(
name: "AllowedBucketIdsJson",
table: "dungeon_palettes",
type: "json",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn(
name: "EnforceBiomeBuckets",
table: "dungeon_palettes",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "tile_buckets",
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"),
BucketType = table.Column(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
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_tile_buckets", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "tile_stamps",
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(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Width = table.Column(type: "int", nullable: false),
Height = table.Column(type: "int", nullable: false),
TilesJson = table.Column(type: "json", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
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_tile_stamps", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "tile_bucket_rules",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
SourceBucketId = table.Column(type: "int", nullable: false),
TargetBucketId = table.Column(type: "int", nullable: false),
Weight = table.Column(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_tile_bucket_rules", x => x.Id);
table.ForeignKey(
name: "FK_tile_bucket_rules_tile_buckets_SourceBucketId",
column: x => x.SourceBucketId,
principalTable: "tile_buckets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_tile_bucket_rules_tile_buckets_TargetBucketId",
column: x => x.TargetBucketId,
principalTable: "tile_buckets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "tile_definition_buckets",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
TileDefinitionId = table.Column(type: "int", nullable: false),
TileBucketId = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_tile_definition_buckets", x => x.Id);
table.ForeignKey(
name: "FK_tile_definition_buckets_tile_buckets_TileBucketId",
column: x => x.TileBucketId,
principalTable: "tile_buckets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_tile_definition_buckets_tile_definitions_TileDefinitionId",
column: x => x.TileDefinitionId,
principalTable: "tile_definitions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_tile_bucket_rules_SourceBucketId",
table: "tile_bucket_rules",
column: "SourceBucketId");
migrationBuilder.CreateIndex(
name: "IX_tile_bucket_rules_TargetBucketId",
table: "tile_bucket_rules",
column: "TargetBucketId");
migrationBuilder.CreateIndex(
name: "IX_tile_definition_buckets_TileBucketId",
table: "tile_definition_buckets",
column: "TileBucketId");
migrationBuilder.CreateIndex(
name: "IX_tile_definition_buckets_TileDefinitionId",
table: "tile_definition_buckets",
column: "TileDefinitionId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "tile_bucket_rules");
migrationBuilder.DropTable(
name: "tile_definition_buckets");
migrationBuilder.DropTable(
name: "tile_stamps");
migrationBuilder.DropTable(
name: "tile_buckets");
migrationBuilder.DropColumn(
name: "IsInteractable",
table: "tile_definitions");
migrationBuilder.DropColumn(
name: "AllowedBucketIdsJson",
table: "dungeon_palettes");
migrationBuilder.DropColumn(
name: "EnforceBiomeBuckets",
table: "dungeon_palettes");
}
}
}