using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Sledgemapper.Api.Migrations
{
    public partial class renameMapToSession : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Maps_Campaigns_CampaignId1",
                table: "Maps");

            migrationBuilder.DropIndex(
                name: "IX_Maps_CampaignId1",
                table: "Maps");

            migrationBuilder.DropColumn(
                name: "CampaignId1",
                table: "Maps");

            migrationBuilder.CreateIndex(
                name: "IX_Sessions_CampaignId",
                table: "Sessions",
                column: "CampaignId");

            migrationBuilder.AddForeignKey(
                name: "FK_Sessions_Campaigns_CampaignId",
                table: "Sessions",
                column: "CampaignId",
                principalTable: "Campaigns",
                principalColumn: "CampaignId",
                onDelete: ReferentialAction.Cascade);
        }

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

            migrationBuilder.DropIndex(
                name: "IX_Sessions_CampaignId",
                table: "Sessions");

            migrationBuilder.AddColumn<Guid>(
                name: "CampaignId1",
                table: "Maps",
                type: "TEXT",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_Maps_CampaignId1",
                table: "Maps",
                column: "CampaignId1");

            migrationBuilder.AddForeignKey(
                name: "FK_Maps_Campaigns_CampaignId1",
                table: "Maps",
                column: "CampaignId1",
                principalTable: "Campaigns",
                principalColumn: "CampaignId",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
