using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Server.DB.Migrations { /// public partial class CharacterDataDraft : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "Username", table: "Accounts", type: "varchar(20)", nullable: true, oldClrType: typeof(string), oldType: "varchar(20)"); migrationBuilder.AlterColumn( name: "Salt", table: "Accounts", type: "bytea", nullable: true, oldClrType: typeof(byte[]), oldType: "bytea"); migrationBuilder.AlterColumn( name: "Password", table: "Accounts", type: "bytea", nullable: true, oldClrType: typeof(byte[]), oldType: "bytea"); migrationBuilder.AlterColumn( name: "Email", table: "Accounts", type: "text", nullable: true, oldClrType: typeof(string), oldType: "text"); migrationBuilder.CreateTable( name: "Characters", columns: table => new { Id = table.Column(type: "uuid", nullable: false), ServerId = table.Column(type: "smallint", nullable: false), AccountId = table.Column(type: "uuid", nullable: false), MapId = table.Column(type: "integer", nullable: false), Name = table.Column(type: "varchar(20)", nullable: true), LastXCoordinate = table.Column(type: "smallint", nullable: false), LastYCoordinate = table.Column(type: "smallint", nullable: false), PvPLevel = table.Column(type: "smallint", nullable: false), Gender = table.Column(type: "smallint", nullable: false), Experience = table.Column(type: "bigint", nullable: false), Level = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Characters"); migrationBuilder.AlterColumn( name: "Username", table: "Accounts", type: "varchar(20)", nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "varchar(20)", oldNullable: true); migrationBuilder.AlterColumn( name: "Salt", table: "Accounts", type: "bytea", nullable: false, defaultValue: new byte[0], oldClrType: typeof(byte[]), oldType: "bytea", oldNullable: true); migrationBuilder.AlterColumn( name: "Password", table: "Accounts", type: "bytea", nullable: false, defaultValue: new byte[0], oldClrType: typeof(byte[]), oldType: "bytea", oldNullable: true); migrationBuilder.AlterColumn( name: "Email", table: "Accounts", type: "text", nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "text", oldNullable: true); } } }