using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Watcher.Migrations { /// public partial class DBUpdateIssue32 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Metrics_Containers_ContainerId", table: "Metrics"); migrationBuilder.DropForeignKey( name: "FK_Metrics_Servers_ServerId", table: "Metrics"); migrationBuilder.DropIndex( name: "IX_Metrics_ContainerId", table: "Metrics"); migrationBuilder.DropIndex( name: "IX_Metrics_ServerId", table: "Metrics"); migrationBuilder.DropColumn( name: "PocketId", table: "Users"); migrationBuilder.DropColumn( name: "ContainerId", table: "Metrics"); migrationBuilder.DropColumn( name: "Type", table: "Metrics"); migrationBuilder.RenameColumn( name: "PreferredUsername", table: "Users", newName: "Username"); migrationBuilder.RenameColumn( name: "Value", table: "Metrics", newName: "RAM_Size"); migrationBuilder.AddColumn( name: "OIDC_Id", table: "Users", type: "TEXT", nullable: true); migrationBuilder.AddColumn( name: "CPU_Load", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "CPU_Temp", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "DISK_Size", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "DISK_Temp", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "DISK_Usage", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "GPU_Load", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "GPU_Temp", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "GPU_Vram_Size", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "GPU_Vram_Usage", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "NET_In", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "NET_Out", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "RAM_Load", table: "Metrics", type: "REAL", nullable: false, defaultValue: 0.0); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "OIDC_Id", table: "Users"); migrationBuilder.DropColumn( name: "CPU_Load", table: "Metrics"); migrationBuilder.DropColumn( name: "CPU_Temp", table: "Metrics"); migrationBuilder.DropColumn( name: "DISK_Size", table: "Metrics"); migrationBuilder.DropColumn( name: "DISK_Temp", table: "Metrics"); migrationBuilder.DropColumn( name: "DISK_Usage", table: "Metrics"); migrationBuilder.DropColumn( name: "GPU_Load", table: "Metrics"); migrationBuilder.DropColumn( name: "GPU_Temp", table: "Metrics"); migrationBuilder.DropColumn( name: "GPU_Vram_Size", table: "Metrics"); migrationBuilder.DropColumn( name: "GPU_Vram_Usage", table: "Metrics"); migrationBuilder.DropColumn( name: "NET_In", table: "Metrics"); migrationBuilder.DropColumn( name: "NET_Out", table: "Metrics"); migrationBuilder.DropColumn( name: "RAM_Load", table: "Metrics"); migrationBuilder.RenameColumn( name: "Username", table: "Users", newName: "PreferredUsername"); migrationBuilder.RenameColumn( name: "RAM_Size", table: "Metrics", newName: "Value"); migrationBuilder.AddColumn( name: "PocketId", table: "Users", type: "TEXT", nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "ContainerId", table: "Metrics", type: "INTEGER", nullable: true); migrationBuilder.AddColumn( name: "Type", table: "Metrics", type: "TEXT", nullable: true); migrationBuilder.CreateIndex( name: "IX_Metrics_ContainerId", table: "Metrics", column: "ContainerId"); migrationBuilder.CreateIndex( name: "IX_Metrics_ServerId", table: "Metrics", column: "ServerId"); migrationBuilder.AddForeignKey( name: "FK_Metrics_Containers_ContainerId", table: "Metrics", column: "ContainerId", principalTable: "Containers", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_Metrics_Servers_ServerId", table: "Metrics", column: "ServerId", principalTable: "Servers", principalColumn: "Id"); } } }