using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace LANCommander.Server.Data.MySQL.Migrations { /// public partial class FixServerShadowProperties : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_ServerConsoles_Servers_ServerId1", table: "ServerConsoles"); migrationBuilder.DropForeignKey( name: "FK_ServerHttpPath_Servers_ServerId1", table: "ServerHttpPath"); migrationBuilder.DropIndex( name: "IX_ServerHttpPath_ServerId1", table: "ServerHttpPath"); migrationBuilder.DropIndex( name: "IX_ServerConsoles_ServerId1", table: "ServerConsoles"); migrationBuilder.DropColumn( name: "ServerId1", table: "ServerHttpPath"); migrationBuilder.DropColumn( name: "ServerId1", table: "ServerConsoles"); migrationBuilder.AlterColumn( name: "Path", table: "ServerHttpPath", type: "varchar(256)", maxLength: 256, nullable: false, oldClrType: typeof(string), oldType: "longtext") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "LocalPath", table: "ServerHttpPath", type: "varchar(1024)", maxLength: 1024, nullable: false, oldClrType: typeof(string), oldType: "longtext") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "Path", table: "ServerConsoles", type: "varchar(1024)", maxLength: 1024, nullable: false, oldClrType: typeof(string), oldType: "longtext") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "Password", table: "ServerConsoles", type: "varchar(128)", maxLength: 128, nullable: false, oldClrType: typeof(string), oldType: "longtext") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "Name", table: "ServerConsoles", type: "varchar(64)", maxLength: 64, nullable: false, oldClrType: typeof(string), oldType: "longtext") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "Host", table: "ServerConsoles", type: "varchar(256)", maxLength: 256, nullable: false, oldClrType: typeof(string), oldType: "longtext") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "Path", table: "ServerHttpPath", type: "longtext", nullable: false, oldClrType: typeof(string), oldType: "varchar(256)", oldMaxLength: 256) .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "LocalPath", table: "ServerHttpPath", type: "longtext", nullable: false, oldClrType: typeof(string), oldType: "varchar(1024)", oldMaxLength: 1024) .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "ServerId1", table: "ServerHttpPath", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.AlterColumn( name: "Path", table: "ServerConsoles", type: "longtext", nullable: false, oldClrType: typeof(string), oldType: "varchar(1024)", oldMaxLength: 1024) .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "Password", table: "ServerConsoles", type: "longtext", nullable: false, oldClrType: typeof(string), oldType: "varchar(128)", oldMaxLength: 128) .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "Name", table: "ServerConsoles", type: "longtext", nullable: false, oldClrType: typeof(string), oldType: "varchar(64)", oldMaxLength: 64) .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "Host", table: "ServerConsoles", type: "longtext", nullable: false, oldClrType: typeof(string), oldType: "varchar(256)", oldMaxLength: 256) .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "ServerId1", table: "ServerConsoles", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.CreateIndex( name: "IX_ServerHttpPath_ServerId1", table: "ServerHttpPath", column: "ServerId1"); migrationBuilder.CreateIndex( name: "IX_ServerConsoles_ServerId1", table: "ServerConsoles", column: "ServerId1"); migrationBuilder.AddForeignKey( name: "FK_ServerConsoles_Servers_ServerId1", table: "ServerConsoles", column: "ServerId1", principalTable: "Servers", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_ServerHttpPath_Servers_ServerId1", table: "ServerHttpPath", column: "ServerId1", principalTable: "Servers", principalColumn: "Id"); } } }