feat: first draft for character data
All checks were successful
Test if Server can be built / build-server (push) Successful in 24s
All checks were successful
Test if Server can be built / build-server (push) Successful in 24s
This commit is contained in:
parent
4499045afe
commit
e58fa35941
4 changed files with 300 additions and 5 deletions
115
Server/DB/Migrations/20230817230423_CharacterDataDraft.Designer.cs
generated
Normal file
115
Server/DB/Migrations/20230817230423_CharacterDataDraft.Designer.cs
generated
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Server.DB;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Server.DB.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(WonderkingContext))]
|
||||||
|
[Migration("20230817230423_CharacterDataDraft")]
|
||||||
|
partial class CharacterDataDraft
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.10")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Server.DB.Documents.Account", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<byte[]>("Password")
|
||||||
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
|
b.Property<byte>("PermissionLevel")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<byte[]>("Salt")
|
||||||
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.HasColumnType("varchar(20)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Accounts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Server.DB.Documents.Character", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("AccountId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("Experience")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<byte>("Gender")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<short>("LastXCoordinate")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<short>("LastYCoordinate")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<byte>("Level")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<int>("MapId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("varchar(20)");
|
||||||
|
|
||||||
|
b.Property<byte>("PvPLevel")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<byte>("ServerId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.ToTable("Characters");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Server.DB.Documents.Character", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Server.DB.Documents.Account", "Account")
|
||||||
|
.WithMany("Characters")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Server.DB.Documents.Account", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Characters");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
Server/DB/Migrations/20230817230423_CharacterDataDraft.cs
Normal file
126
Server/DB/Migrations/20230817230423_CharacterDataDraft.cs
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Server.DB.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class CharacterDataDraft : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Username",
|
||||||
|
table: "Accounts",
|
||||||
|
type: "varchar(20)",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(20)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<byte[]>(
|
||||||
|
name: "Salt",
|
||||||
|
table: "Accounts",
|
||||||
|
type: "bytea",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(byte[]),
|
||||||
|
oldType: "bytea");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<byte[]>(
|
||||||
|
name: "Password",
|
||||||
|
table: "Accounts",
|
||||||
|
type: "bytea",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(byte[]),
|
||||||
|
oldType: "bytea");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Email",
|
||||||
|
table: "Accounts",
|
||||||
|
type: "text",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "text");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Characters",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
ServerId = table.Column<byte>(type: "smallint", nullable: false),
|
||||||
|
AccountId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
MapId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "varchar(20)", nullable: true),
|
||||||
|
LastXCoordinate = table.Column<short>(type: "smallint", nullable: false),
|
||||||
|
LastYCoordinate = table.Column<short>(type: "smallint", nullable: false),
|
||||||
|
PvPLevel = table.Column<byte>(type: "smallint", nullable: false),
|
||||||
|
Gender = table.Column<byte>(type: "smallint", nullable: false),
|
||||||
|
Experience = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Level = table.Column<byte>(type: "smallint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Characters", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Characters_Accounts_AccountId",
|
||||||
|
column: x => x.AccountId,
|
||||||
|
principalTable: "Accounts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Characters_AccountId",
|
||||||
|
table: "Characters",
|
||||||
|
column: "AccountId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Characters");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Username",
|
||||||
|
table: "Accounts",
|
||||||
|
type: "varchar(20)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(20)",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<byte[]>(
|
||||||
|
name: "Salt",
|
||||||
|
table: "Accounts",
|
||||||
|
type: "bytea",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new byte[0],
|
||||||
|
oldClrType: typeof(byte[]),
|
||||||
|
oldType: "bytea",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<byte[]>(
|
||||||
|
name: "Password",
|
||||||
|
table: "Accounts",
|
||||||
|
type: "bytea",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new byte[0],
|
||||||
|
oldClrType: typeof(byte[]),
|
||||||
|
oldType: "bytea",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Email",
|
||||||
|
table: "Accounts",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "text",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,28 +29,83 @@ namespace Server.DB.Migrations
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<byte[]>("Password")
|
b.Property<byte[]>("Password")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("bytea");
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
b.Property<byte>("PermissionLevel")
|
b.Property<byte>("PermissionLevel")
|
||||||
.HasColumnType("smallint");
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.Property<byte[]>("Salt")
|
b.Property<byte[]>("Salt")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("bytea");
|
.HasColumnType("bytea");
|
||||||
|
|
||||||
b.Property<string>("Username")
|
b.Property<string>("Username")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("varchar(20)");
|
.HasColumnType("varchar(20)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Accounts");
|
b.ToTable("Accounts");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Server.DB.Documents.Character", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("AccountId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("Experience")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<byte>("Gender")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<short>("LastXCoordinate")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<short>("LastYCoordinate")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<byte>("Level")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<int>("MapId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("varchar(20)");
|
||||||
|
|
||||||
|
b.Property<byte>("PvPLevel")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<byte>("ServerId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.ToTable("Characters");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Server.DB.Documents.Character", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Server.DB.Documents.Account", "Account")
|
||||||
|
.WithMany("Characters")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Server.DB.Documents.Account", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Characters");
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class WonderkingContext : DbContext
|
||||||
}).Entity<Character>(builder =>
|
}).Entity<Character>(builder =>
|
||||||
{
|
{
|
||||||
builder.HasKey(c => c.Id);
|
builder.HasKey(c => c.Id);
|
||||||
builder.HasOne<Account>().WithOne().HasForeignKey("AccountId").IsRequired();
|
|
||||||
builder.Property(c => c.Name).HasColumnType("varchar(20)");
|
builder.Property(c => c.Name).HasColumnType("varchar(20)");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue