187 lines
8.3 KiB
C#
187 lines
8.3 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SystemRevivalServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class BuilderChanges : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsInteractable",
|
|
table: "tile_definitions",
|
|
type: "tinyint(1)",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "AllowedBucketIdsJson",
|
|
table: "dungeon_palettes",
|
|
type: "json",
|
|
nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "EnforceBiomeBuckets",
|
|
table: "dungeon_palettes",
|
|
type: "tinyint(1)",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "tile_buckets",
|
|
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"),
|
|
BucketType = table.Column<string>(type: "varchar(32)", maxLength: 32, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
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_tile_buckets", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "tile_stamps",
|
|
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(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Width = table.Column<int>(type: "int", nullable: false),
|
|
Height = table.Column<int>(type: "int", nullable: false),
|
|
TilesJson = table.Column<string>(type: "json", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
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_tile_stamps", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "tile_bucket_rules",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
SourceBucketId = table.Column<int>(type: "int", nullable: false),
|
|
TargetBucketId = table.Column<int>(type: "int", nullable: false),
|
|
Weight = table.Column<float>(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<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
TileDefinitionId = table.Column<int>(type: "int", nullable: false),
|
|
TileBucketId = table.Column<int>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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");
|
|
}
|
|
}
|
|
}
|