using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AsbCloudDb.Migrations
{
    public partial class Rename_t_trajectory_plan : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_t_trajectory_planned_t_user_id_user",
                table: "t_trajectory_planned");

            migrationBuilder.DropForeignKey(
                name: "FK_t_trajectory_planned_t_well_id_well",
                table: "t_trajectory_planned");

            migrationBuilder.DropPrimaryKey(
                name: "PK_t_trajectory_planned",
                table: "t_trajectory_planned");

            migrationBuilder.RenameTable(
                name: "t_trajectory_planned",
                newName: "t_trajectory_plan");

            migrationBuilder.RenameIndex(
                name: "IX_t_trajectory_planned_id_well",
                table: "t_trajectory_plan",
                newName: "IX_t_trajectory_plan_id_well");

            migrationBuilder.RenameIndex(
                name: "IX_t_trajectory_planned_id_user",
                table: "t_trajectory_plan",
                newName: "IX_t_trajectory_plan_id_user");

            migrationBuilder.AddPrimaryKey(
                name: "PK_t_trajectory_plan",
                table: "t_trajectory_plan",
                column: "id");

            migrationBuilder.AddForeignKey(
                name: "FK_t_trajectory_plan_t_user_id_user",
                table: "t_trajectory_plan",
                column: "id_user",
                principalTable: "t_user",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_t_trajectory_plan_t_well_id_well",
                table: "t_trajectory_plan",
                column: "id_well",
                principalTable: "t_well",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_t_trajectory_plan_t_user_id_user",
                table: "t_trajectory_plan");

            migrationBuilder.DropForeignKey(
                name: "FK_t_trajectory_plan_t_well_id_well",
                table: "t_trajectory_plan");

            migrationBuilder.DropPrimaryKey(
                name: "PK_t_trajectory_plan",
                table: "t_trajectory_plan");

            migrationBuilder.RenameTable(
                name: "t_trajectory_plan",
                newName: "t_trajectory_planned");

            migrationBuilder.RenameIndex(
                name: "IX_t_trajectory_plan_id_well",
                table: "t_trajectory_planned",
                newName: "IX_t_trajectory_planned_id_well");

            migrationBuilder.RenameIndex(
                name: "IX_t_trajectory_plan_id_user",
                table: "t_trajectory_planned",
                newName: "IX_t_trajectory_planned_id_user");

            migrationBuilder.AddPrimaryKey(
                name: "PK_t_trajectory_planned",
                table: "t_trajectory_planned",
                column: "id");

            migrationBuilder.AddForeignKey(
                name: "FK_t_trajectory_planned_t_user_id_user",
                table: "t_trajectory_planned",
                column: "id_user",
                principalTable: "t_user",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_t_trajectory_planned_t_well_id_well",
                table: "t_trajectory_planned",
                column: "id_well",
                principalTable: "t_well",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}