20260106012211_Migration_20260106092154.cs 2.08 KB
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Rcs.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class Migration_20260106092154 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_robot_tasks_task_templates_task_template_id",
                table: "robot_tasks");

            migrationBuilder.AlterColumn<Guid>(
                name: "task_template_id",
                table: "robot_tasks",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid");

            migrationBuilder.AddForeignKey(
                name: "FK_robot_tasks_task_templates_task_template_id",
                table: "robot_tasks",
                column: "task_template_id",
                principalTable: "task_templates",
                principalColumn: "template_id",
                onDelete: ReferentialAction.SetNull);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_robot_tasks_task_templates_task_template_id",
                table: "robot_tasks");

            migrationBuilder.AlterColumn<Guid>(
                name: "task_template_id",
                table: "robot_tasks",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_robot_tasks_task_templates_task_template_id",
                table: "robot_tasks",
                column: "task_template_id",
                principalTable: "task_templates",
                principalColumn: "template_id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}