fix(backend): add missing domain foreign keys
This commit is contained in:
@@ -0,0 +1,405 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Socialize.Api.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
internal partial class AddMissingDomainForeignKeys : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FeedbackReports_CampaignId",
|
||||
table: "FeedbackReports",
|
||||
column: "CampaignId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FeedbackReports_ClientId",
|
||||
table: "FeedbackReports",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FeedbackReports_ContentItemId",
|
||||
table: "FeedbackReports",
|
||||
column: "ContentItemId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ApprovalDecisions_ApprovalRequests_ApprovalRequestId",
|
||||
table: "ApprovalDecisions",
|
||||
column: "ApprovalRequestId",
|
||||
principalTable: "ApprovalRequests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ApprovalRequests_ApprovalWorkflowInstances_WorkflowInstance~",
|
||||
table: "ApprovalRequests",
|
||||
column: "WorkflowInstanceId",
|
||||
principalTable: "ApprovalWorkflowInstances",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ApprovalRequests_ContentItems_ContentItemId",
|
||||
table: "ApprovalRequests",
|
||||
column: "ContentItemId",
|
||||
principalTable: "ContentItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ApprovalRequests_Workspaces_WorkspaceId",
|
||||
table: "ApprovalRequests",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ApprovalWorkflowInstances_ContentItems_ContentItemId",
|
||||
table: "ApprovalWorkflowInstances",
|
||||
column: "ContentItemId",
|
||||
principalTable: "ContentItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ApprovalWorkflowInstances_Workspaces_WorkspaceId",
|
||||
table: "ApprovalWorkflowInstances",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AssetRevisions_Assets_AssetId",
|
||||
table: "AssetRevisions",
|
||||
column: "AssetId",
|
||||
principalTable: "Assets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Assets_ContentItems_ContentItemId",
|
||||
table: "Assets",
|
||||
column: "ContentItemId",
|
||||
principalTable: "ContentItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Assets_Workspaces_WorkspaceId",
|
||||
table: "Assets",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Campaigns_Clients_ClientId",
|
||||
table: "Campaigns",
|
||||
column: "ClientId",
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Campaigns_Workspaces_WorkspaceId",
|
||||
table: "Campaigns",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Channels_Workspaces_WorkspaceId",
|
||||
table: "Channels",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Clients_Workspaces_WorkspaceId",
|
||||
table: "Clients",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Comments_Comments_ParentCommentId",
|
||||
table: "Comments",
|
||||
column: "ParentCommentId",
|
||||
principalTable: "Comments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Comments_ContentItems_ContentItemId",
|
||||
table: "Comments",
|
||||
column: "ContentItemId",
|
||||
principalTable: "ContentItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Comments_Workspaces_WorkspaceId",
|
||||
table: "Comments",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ContentItemActivityEntries_ContentItems_ContentItemId",
|
||||
table: "ContentItemActivityEntries",
|
||||
column: "ContentItemId",
|
||||
principalTable: "ContentItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ContentItemActivityEntries_Workspaces_WorkspaceId",
|
||||
table: "ContentItemActivityEntries",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ContentItemRevisions_ContentItems_ContentItemId",
|
||||
table: "ContentItemRevisions",
|
||||
column: "ContentItemId",
|
||||
principalTable: "ContentItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ContentItems_Campaigns_CampaignId",
|
||||
table: "ContentItems",
|
||||
column: "CampaignId",
|
||||
principalTable: "Campaigns",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ContentItems_Clients_ClientId",
|
||||
table: "ContentItems",
|
||||
column: "ClientId",
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ContentItems_Workspaces_WorkspaceId",
|
||||
table: "ContentItems",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeedbackReports_Campaigns_CampaignId",
|
||||
table: "FeedbackReports",
|
||||
column: "CampaignId",
|
||||
principalTable: "Campaigns",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeedbackReports_Clients_ClientId",
|
||||
table: "FeedbackReports",
|
||||
column: "ClientId",
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeedbackReports_ContentItems_ContentItemId",
|
||||
table: "FeedbackReports",
|
||||
column: "ContentItemId",
|
||||
principalTable: "ContentItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeedbackReports_Workspaces_WorkspaceId",
|
||||
table: "FeedbackReports",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_NotificationEvents_ContentItems_ContentItemId",
|
||||
table: "NotificationEvents",
|
||||
column: "ContentItemId",
|
||||
principalTable: "ContentItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_NotificationEvents_Workspaces_WorkspaceId",
|
||||
table: "NotificationEvents",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_WorkspaceApprovalStepConfigurations_Workspaces_WorkspaceId",
|
||||
table: "WorkspaceApprovalStepConfigurations",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_WorkspaceInvites_Workspaces_WorkspaceId",
|
||||
table: "WorkspaceInvites",
|
||||
column: "WorkspaceId",
|
||||
principalTable: "Workspaces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ApprovalDecisions_ApprovalRequests_ApprovalRequestId",
|
||||
table: "ApprovalDecisions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ApprovalRequests_ApprovalWorkflowInstances_WorkflowInstance~",
|
||||
table: "ApprovalRequests");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ApprovalRequests_ContentItems_ContentItemId",
|
||||
table: "ApprovalRequests");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ApprovalRequests_Workspaces_WorkspaceId",
|
||||
table: "ApprovalRequests");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ApprovalWorkflowInstances_ContentItems_ContentItemId",
|
||||
table: "ApprovalWorkflowInstances");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ApprovalWorkflowInstances_Workspaces_WorkspaceId",
|
||||
table: "ApprovalWorkflowInstances");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AssetRevisions_Assets_AssetId",
|
||||
table: "AssetRevisions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Assets_ContentItems_ContentItemId",
|
||||
table: "Assets");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Assets_Workspaces_WorkspaceId",
|
||||
table: "Assets");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Campaigns_Clients_ClientId",
|
||||
table: "Campaigns");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Campaigns_Workspaces_WorkspaceId",
|
||||
table: "Campaigns");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Channels_Workspaces_WorkspaceId",
|
||||
table: "Channels");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Clients_Workspaces_WorkspaceId",
|
||||
table: "Clients");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Comments_Comments_ParentCommentId",
|
||||
table: "Comments");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Comments_ContentItems_ContentItemId",
|
||||
table: "Comments");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Comments_Workspaces_WorkspaceId",
|
||||
table: "Comments");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ContentItemActivityEntries_ContentItems_ContentItemId",
|
||||
table: "ContentItemActivityEntries");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ContentItemActivityEntries_Workspaces_WorkspaceId",
|
||||
table: "ContentItemActivityEntries");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ContentItemRevisions_ContentItems_ContentItemId",
|
||||
table: "ContentItemRevisions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ContentItems_Campaigns_CampaignId",
|
||||
table: "ContentItems");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ContentItems_Clients_ClientId",
|
||||
table: "ContentItems");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ContentItems_Workspaces_WorkspaceId",
|
||||
table: "ContentItems");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeedbackReports_Campaigns_CampaignId",
|
||||
table: "FeedbackReports");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeedbackReports_Clients_ClientId",
|
||||
table: "FeedbackReports");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeedbackReports_ContentItems_ContentItemId",
|
||||
table: "FeedbackReports");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeedbackReports_Workspaces_WorkspaceId",
|
||||
table: "FeedbackReports");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_NotificationEvents_ContentItems_ContentItemId",
|
||||
table: "NotificationEvents");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_NotificationEvents_Workspaces_WorkspaceId",
|
||||
table: "NotificationEvents");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_WorkspaceApprovalStepConfigurations_Workspaces_WorkspaceId",
|
||||
table: "WorkspaceApprovalStepConfigurations");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_WorkspaceInvites_Workspaces_WorkspaceId",
|
||||
table: "WorkspaceInvites");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_FeedbackReports_CampaignId",
|
||||
table: "FeedbackReports");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_FeedbackReports_ClientId",
|
||||
table: "FeedbackReports");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_FeedbackReports_ContentItemId",
|
||||
table: "FeedbackReports");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user