using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Minecraft_Realms_Emulator.Migrations
{
///
public partial class Players : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Players",
table: "Worlds");
migrationBuilder.CreateTable(
name: "Players",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column(type: "text", nullable: false),
Uuid = table.Column(type: "text", nullable: false),
Operator = table.Column(type: "boolean", nullable: false),
Accepted = table.Column(type: "boolean", nullable: false),
Online = table.Column(type: "boolean", nullable: false),
Permission = table.Column(type: "text", nullable: false),
WorldId = table.Column(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");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Players");
migrationBuilder.AddColumn(
name: "Players",
table: "Worlds",
type: "text[]",
nullable: false,
defaultValue: new string[0]);
}
}
}