CREATE TABLE "__EFMigrationsHistory" (
    "MigrationId" TEXT NOT NULL CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY,
    "ProductVersion" TEXT NOT NULL
);
CREATE TABLE "Tags" (
    "Id" INTEGER NOT NULL CONSTRAINT "PK_Tags" PRIMARY KEY AUTOINCREMENT,
    "Name" TEXT NULL
);
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE "Servers" (
    "Id" INTEGER NOT NULL CONSTRAINT "PK_Servers" PRIMARY KEY AUTOINCREMENT,
    "CpuCores" INTEGER NOT NULL,
    "CpuType" TEXT NULL,
    "CreatedAt" TEXT NOT NULL,
    "Description" TEXT NULL,
    "GpuType" TEXT NULL,
    "IPAddress" TEXT NOT NULL,
    "IsOnline" INTEGER NOT NULL,
    "LastSeen" TEXT NOT NULL,
    "Name" TEXT NOT NULL,
    "RamSize" REAL NOT NULL,
    "TagId" INTEGER NULL,
    "Type" TEXT NOT NULL, "IsVerified" INTEGER NOT NULL DEFAULT 0,
    CONSTRAINT "FK_Servers_Tags_TagId" FOREIGN KEY ("TagId") REFERENCES "Tags" ("Id")
);
CREATE TABLE "LogEvents" (
    "Id" INTEGER NOT NULL CONSTRAINT "PK_LogEvents" PRIMARY KEY AUTOINCREMENT,
    "ContainerId" INTEGER NULL,
    "Level" TEXT NULL,
    "Message" TEXT NULL,
    "ServerId" INTEGER NULL,
    "Timestamp" TEXT NOT NULL,
    CONSTRAINT "FK_LogEvents_Containers_ContainerId" FOREIGN KEY ("ContainerId") REFERENCES "Containers" ("Id"),
    CONSTRAINT "FK_LogEvents_Servers_ServerId" FOREIGN KEY ("ServerId") REFERENCES "Servers" ("Id")
);
CREATE TABLE "Images" (
    "Id" INTEGER NOT NULL CONSTRAINT "PK_Images" PRIMARY KEY AUTOINCREMENT,
    "Name" TEXT NULL,
    "Tag" TEXT NULL
);
CREATE TABLE "Containers" (
    "Id" INTEGER NOT NULL CONSTRAINT "PK_Containers" PRIMARY KEY AUTOINCREMENT,
    "CreatedAt" TEXT NOT NULL,
    "Hostname" TEXT NOT NULL,
    "ImageId" INTEGER NULL,
    "IsRunning" INTEGER NOT NULL,
    "Name" TEXT NOT NULL,
    "Status" TEXT NOT NULL,
    "TagId" INTEGER NULL,
    "Type" TEXT NOT NULL,
    CONSTRAINT "FK_Containers_Images_ImageId" FOREIGN KEY ("ImageId") REFERENCES "Images" ("Id"),
    CONSTRAINT "FK_Containers_Tags_TagId" FOREIGN KEY ("TagId") REFERENCES "Tags" ("Id")
);
CREATE TABLE "Metrics" (
    "Id" INTEGER NOT NULL CONSTRAINT "PK_Metrics" PRIMARY KEY AUTOINCREMENT,
    "CPU_Load" REAL NOT NULL,
    "CPU_Temp" REAL NOT NULL,
    "DISK_Size" REAL NOT NULL,
    "DISK_Temp" REAL NOT NULL,
    "DISK_Usage" REAL NOT NULL,
    "GPU_Load" REAL NOT NULL,
    "GPU_Temp" REAL NOT NULL,
    "GPU_Vram_Size" REAL NOT NULL,
    "GPU_Vram_Usage" REAL NOT NULL,
    "NET_In" REAL NOT NULL,
    "NET_Out" REAL NOT NULL,
    "RAM_Load" REAL NOT NULL,
    "RAM_Size" REAL NOT NULL,
    "ServerId" INTEGER NULL,
    "Timestamp" TEXT NOT NULL
);
CREATE TABLE "Users" (
    "Id" INTEGER NOT NULL CONSTRAINT "PK_Users" PRIMARY KEY AUTOINCREMENT,
    "Email" TEXT NULL,
    "IdentityProvider" TEXT NOT NULL,
    "LastLogin" TEXT NOT NULL,
    "OIDC_Id" TEXT NULL,
    "Password" TEXT NOT NULL,
    "Username" TEXT NOT NULL
);
INSERT INTO __EFMigrationsHistory (MigrationId,ProductVersion) VALUES ('20250617153602_InitialMigration','8.0.6');
INSERT INTO __EFMigrationsHistory (MigrationId,ProductVersion) VALUES ('20250617165126_ServerPrimaryKey','8.0.6');
INSERT INTO __EFMigrationsHistory (MigrationId,ProductVersion) VALUES ('20250617174242_UserPasswordAdded','8.0.6');
INSERT INTO __EFMigrationsHistory (MigrationId,ProductVersion) VALUES ('20250621124832_DB-Update Issue#32','8.0.6');
INSERT INTO __EFMigrationsHistory (MigrationId,ProductVersion) VALUES ('20250621125157_DB-Update Issue#32 IsVerified-Servers','8.0.6');
INSERT INTO Servers (Id,CpuCores,CpuType,CreatedAt,Description,GpuType,IPAddress,IsOnline,LastSeen,Name,RamSize,TagId,Type,IsVerified) VALUES ('2','0','','2025-06-21 13:56:23.5504821','','','192.168.178.158','1','2025-06-23 14:30:23.9455939','Ubuntu Workstation','0',NULL,'Standalone','0');
INSERT INTO Servers (Id,CpuCores,CpuType,CreatedAt,Description,GpuType,IPAddress,IsOnline,LastSeen,Name,RamSize,TagId,Type,IsVerified) VALUES ('3','0','','2025-06-23 14:03:08.8875782','','','82.29.178.161','0','0001-01-01 00:00:00','hostinger-vps-1','0',NULL,'VPS','0');
INSERT INTO Servers (Id,CpuCores,CpuType,CreatedAt,Description,GpuType,IPAddress,IsOnline,LastSeen,Name,RamSize,TagId,Type,IsVerified) VALUES ('4','0','','2025-06-23 14:07:49.0219821','','','192.168.178.68','0','0001-01-01 00:00:00','Unraid NAS','0',NULL,'Standalone','0');
INSERT INTO Users (Id,Email,IdentityProvider,LastLogin,OIDC_Id,Password,Username) VALUES ('1','','local','2025-06-21 13:54:26.4374285','','$2a$11$iWF.vOrHuzgelKm3xWeJouVtmUd7LemK11yDxlw9t.YbLUZtJWRH6','admin');
