Files
watcher/Watcher/Migrations/20250621124832_DB-Update Issue#32.cs

252 lines
7.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Watcher.Migrations
{
/// <inheritdoc />
public partial class DBUpdateIssue32 : Migration
{
/// <inheritdoc />
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<string>(
name: "OIDC_Id",
table: "Users",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<double>(
name: "CPU_Load",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "CPU_Temp",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "DISK_Size",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "DISK_Temp",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "DISK_Usage",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "GPU_Load",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "GPU_Temp",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "GPU_Vram_Size",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "GPU_Vram_Usage",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "NET_In",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "NET_Out",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "RAM_Load",
table: "Metrics",
type: "REAL",
nullable: false,
defaultValue: 0.0);
}
/// <inheritdoc />
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<string>(
name: "PocketId",
table: "Users",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<int>(
name: "ContainerId",
table: "Metrics",
type: "INTEGER",
nullable: true);
migrationBuilder.AddColumn<string>(
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");
}
}
}