Timothy Schenk
1363ddf8fe
Some checks failed
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 25s
Build, Package and Push Images / sbom-scan (push) Successful in 35s
Build, Package and Push Images / container-build (push) Failing after 56s
Build, Package and Push Images / container-sbom-scan (push) Has been skipped
Build, Package and Push Images / sonarqube (push) Successful in 1m20s
125 lines
4.2 KiB
C#
125 lines
4.2 KiB
C#
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
|
|
|
#nullable disable
|
|
|
|
namespace Server.DB.Migrations;
|
|
using Microsoft.EntityFrameworkCore.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: Array.Empty<byte>(),
|
|
oldClrType: typeof(byte[]),
|
|
oldType: "bytea",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<byte[]>(
|
|
name: "Password",
|
|
table: "Accounts",
|
|
type: "bytea",
|
|
nullable: false,
|
|
defaultValue: Array.Empty<byte>(),
|
|
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);
|
|
}
|
|
}
|