InventoryAgent/Inventory.Core/Migrations/20251019025843_InitialCreate.cs

60 lines
2.8 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Inventory.Core.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Devices",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
HardwareIdentifier = table.Column<string>(type: "nvarchar(450)", nullable: true),
ComputerName = table.Column<string>(type: "nvarchar(max)", nullable: true),
DeviceType = table.Column<string>(type: "nvarchar(max)", nullable: true),
SerialNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
MotherboardSerialNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
SystemUUID = table.Column<string>(type: "nvarchar(max)", nullable: true),
Processor = table.Column<string>(type: "nvarchar(max)", nullable: true),
RAM = table.Column<string>(type: "nvarchar(max)", nullable: true),
GPUs = table.Column<string>(type: "nvarchar(max)", nullable: true),
Storage = table.Column<string>(type: "nvarchar(max)", nullable: true),
HasOpticalDrive = table.Column<bool>(type: "bit", nullable: false),
Monitors = table.Column<string>(type: "nvarchar(max)", nullable: true),
OSVersion = table.Column<string>(type: "nvarchar(max)", nullable: true),
OSLicenseKey = table.Column<string>(type: "nvarchar(max)", nullable: true),
IPAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
MACAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
PreviousIPAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastSeen = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Devices", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Devices_HardwareIdentifier",
table: "Devices",
column: "HardwareIdentifier",
unique: true,
filter: "[HardwareIdentifier] IS NOT NULL");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Devices");
}
}
}