Refactor code structure for improved readability and maintainability
This commit is contained in:
204
Migrations/20260516141719_RenameDeploymentAndJobColumns.cs
Normal file
204
Migrations/20260516141719_RenameDeploymentAndJobColumns.cs
Normal file
@@ -0,0 +1,204 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RenameDeploymentAndJobColumns : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentExecutions_DeploymentBatches_DeploymentGroupId",
|
||||
table: "DeploymentExecutions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentJobSteps_DeploymentJobSteps_DependsOnQueueJobStepId",
|
||||
table: "DeploymentJobSteps");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentJobSteps_DeploymentJobs_QueueJobId",
|
||||
table: "DeploymentJobSteps");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentJobTargets_DeploymentJobs_QueueJobId",
|
||||
table: "DeploymentJobTargets");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "QueueJobId",
|
||||
table: "DeploymentJobTargets",
|
||||
newName: "DeploymentJobId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DeploymentGroupId",
|
||||
table: "DeploymentJobTargets",
|
||||
newName: "DeploymentBatchId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentJobTargets_QueueJobId",
|
||||
table: "DeploymentJobTargets",
|
||||
newName: "IX_DeploymentJobTargets_DeploymentJobId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "QueueJobId",
|
||||
table: "DeploymentJobSteps",
|
||||
newName: "DeploymentJobId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DependsOnQueueJobStepId",
|
||||
table: "DeploymentJobSteps",
|
||||
newName: "DependsOnDeploymentJobStepId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentJobSteps_QueueJobId",
|
||||
table: "DeploymentJobSteps",
|
||||
newName: "IX_DeploymentJobSteps_DeploymentJobId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentJobSteps_DependsOnQueueJobStepId",
|
||||
table: "DeploymentJobSteps",
|
||||
newName: "IX_DeploymentJobSteps_DependsOnDeploymentJobStepId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DeploymentGroupId",
|
||||
table: "DeploymentExecutions",
|
||||
newName: "DeploymentBatchId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentExecutions_DeploymentGroupId",
|
||||
table: "DeploymentExecutions",
|
||||
newName: "IX_DeploymentExecutions_DeploymentBatchId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentExecutions_DeploymentBatches_DeploymentBatchId",
|
||||
table: "DeploymentExecutions",
|
||||
column: "DeploymentBatchId",
|
||||
principalTable: "DeploymentBatches",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentJobSteps_DeploymentJobSteps_DependsOnDeploymentJobStepId",
|
||||
table: "DeploymentJobSteps",
|
||||
column: "DependsOnDeploymentJobStepId",
|
||||
principalTable: "DeploymentJobSteps",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentJobSteps_DeploymentJobs_DeploymentJobId",
|
||||
table: "DeploymentJobSteps",
|
||||
column: "DeploymentJobId",
|
||||
principalTable: "DeploymentJobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentJobTargets_DeploymentJobs_DeploymentJobId",
|
||||
table: "DeploymentJobTargets",
|
||||
column: "DeploymentJobId",
|
||||
principalTable: "DeploymentJobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentExecutions_DeploymentBatches_DeploymentBatchId",
|
||||
table: "DeploymentExecutions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentJobSteps_DeploymentJobSteps_DependsOnDeploymentJobStepId",
|
||||
table: "DeploymentJobSteps");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentJobSteps_DeploymentJobs_DeploymentJobId",
|
||||
table: "DeploymentJobSteps");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DeploymentJobTargets_DeploymentJobs_DeploymentJobId",
|
||||
table: "DeploymentJobTargets");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DeploymentJobId",
|
||||
table: "DeploymentJobTargets",
|
||||
newName: "QueueJobId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DeploymentBatchId",
|
||||
table: "DeploymentJobTargets",
|
||||
newName: "DeploymentGroupId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentJobTargets_DeploymentJobId",
|
||||
table: "DeploymentJobTargets",
|
||||
newName: "IX_DeploymentJobTargets_QueueJobId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DeploymentJobId",
|
||||
table: "DeploymentJobSteps",
|
||||
newName: "QueueJobId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DependsOnDeploymentJobStepId",
|
||||
table: "DeploymentJobSteps",
|
||||
newName: "DependsOnQueueJobStepId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentJobSteps_DeploymentJobId",
|
||||
table: "DeploymentJobSteps",
|
||||
newName: "IX_DeploymentJobSteps_QueueJobId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentJobSteps_DependsOnDeploymentJobStepId",
|
||||
table: "DeploymentJobSteps",
|
||||
newName: "IX_DeploymentJobSteps_DependsOnQueueJobStepId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DeploymentBatchId",
|
||||
table: "DeploymentExecutions",
|
||||
newName: "DeploymentGroupId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_DeploymentExecutions_DeploymentBatchId",
|
||||
table: "DeploymentExecutions",
|
||||
newName: "IX_DeploymentExecutions_DeploymentGroupId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentExecutions_DeploymentBatches_DeploymentGroupId",
|
||||
table: "DeploymentExecutions",
|
||||
column: "DeploymentGroupId",
|
||||
principalTable: "DeploymentBatches",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentJobSteps_DeploymentJobSteps_DependsOnQueueJobStepId",
|
||||
table: "DeploymentJobSteps",
|
||||
column: "DependsOnQueueJobStepId",
|
||||
principalTable: "DeploymentJobSteps",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentJobSteps_DeploymentJobs_QueueJobId",
|
||||
table: "DeploymentJobSteps",
|
||||
column: "QueueJobId",
|
||||
principalTable: "DeploymentJobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DeploymentJobTargets_DeploymentJobs_QueueJobId",
|
||||
table: "DeploymentJobTargets",
|
||||
column: "QueueJobId",
|
||||
principalTable: "DeploymentJobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user