using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Monitoring.Infrastructure.Data.Migrations;

/// <inheritdoc />
public partial class AddAssetToUserLogs : Migration
{
	/// <inheritdoc />
	protected override void Up(MigrationBuilder migrationBuilder)
	{
		_ = migrationBuilder.AddColumn<Guid>(
			name: "AssetId",
			table: "UserLogs",
			type: "uuid",
			nullable: false,
			defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

		_ = migrationBuilder.CreateIndex(
			name: "IX_UserLogs_AssetId",
			table: "UserLogs",
			column: "AssetId");

		_ = migrationBuilder.AddForeignKey(
			name: "FK_UserLogs_Assets_AssetId",
			table: "UserLogs",
			column: "AssetId",
			principalTable: "Assets",
			principalColumn: "Id",
			onDelete: ReferentialAction.Cascade);
	}

	/// <inheritdoc />
	protected override void Down(MigrationBuilder migrationBuilder)
	{
		_ = migrationBuilder.DropForeignKey(
			name: "FK_UserLogs_Assets_AssetId",
			table: "UserLogs");

		_ = migrationBuilder.DropIndex(
			name: "IX_UserLogs_AssetId",
			table: "UserLogs");

		_ = migrationBuilder.DropColumn(
			name: "AssetId",
			table: "UserLogs");
	}
}
