1
0
mirror of https://github.com/CyberL1/MyMcRealms.git synced 2024-09-19 16:02:51 -04:00
MyMcRealms/Minecraft-Realms-Emulator/Migrations/20240221131108_Players.cs
2024-04-20 09:20:30 +02:00

64 lines
2.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Minecraft_Realms_Emulator.Migrations
{
/// <inheritdoc />
public partial class Players : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Players",
table: "Worlds");
migrationBuilder.CreateTable(
name: "Players",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Uuid = table.Column<string>(type: "text", nullable: false),
Operator = table.Column<bool>(type: "boolean", nullable: false),
Accepted = table.Column<bool>(type: "boolean", nullable: false),
Online = table.Column<bool>(type: "boolean", nullable: false),
Permission = table.Column<string>(type: "text", nullable: false),
WorldId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Players", x => x.Id);
table.ForeignKey(
name: "FK_Players_Worlds_WorldId",
column: x => x.WorldId,
principalTable: "Worlds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Players_WorldId",
table: "Players",
column: "WorldId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Players");
migrationBuilder.AddColumn<string[]>(
name: "Players",
table: "Worlds",
type: "text[]",
nullable: false,
defaultValue: new string[0]);
}
}
}