73 lines
2.3 KiB
C#
73 lines
2.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SystemRevivalServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class tableUpdatesForWorld : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsPvpEnabled",
|
|
table: "world_zones",
|
|
type: "tinyint(1)",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "ZoneZ",
|
|
table: "world_zones",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "WorldZoneZ",
|
|
table: "dungeon_characters",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
// Drop old 3-column unique index before creating the new 4-column one
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_world_zones_RegionId_ZoneX_ZoneY",
|
|
table: "world_zones");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_world_zones_RegionId_ZoneX_ZoneY_ZoneZ",
|
|
table: "world_zones",
|
|
columns: new[] { "RegionId", "ZoneX", "ZoneY", "ZoneZ" },
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_world_zones_RegionId_ZoneX_ZoneY_ZoneZ",
|
|
table: "world_zones");
|
|
|
|
// Restore old 3-column unique index
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_world_zones_RegionId_ZoneX_ZoneY",
|
|
table: "world_zones",
|
|
columns: new[] { "RegionId", "ZoneX", "ZoneY" },
|
|
unique: true);
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "IsPvpEnabled",
|
|
table: "world_zones");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ZoneZ",
|
|
table: "world_zones");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WorldZoneZ",
|
|
table: "dungeon_characters");
|
|
}
|
|
}
|
|
}
|