fix(backend): add missing domain foreign keys
This commit is contained in:
2173
backend/src/Socialize.Api/Migrations/20260507185052_AddMissingDomainForeignKeys.Designer.cs
generated
Normal file
2173
backend/src/Socialize.Api/Migrations/20260507185052_AddMissingDomainForeignKeys.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1359,6 +1359,12 @@ namespace Socialize.Api.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampaignId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("ContentItemId");
|
||||
|
||||
b.HasIndex("LastActivityAt");
|
||||
|
||||
b.HasIndex("ReporterUserId");
|
||||
@@ -1856,6 +1862,83 @@ namespace Socialize.Api.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Approvals.Data.ApprovalDecision", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Approvals.Data.ApprovalRequest", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ApprovalRequestId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Approvals.Data.ApprovalRequest", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.ContentItems.Data.ContentItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentItemId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Approvals.Data.ApprovalWorkflowInstance", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkflowInstanceId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Approvals.Data.ApprovalWorkflowInstance", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.ContentItems.Data.ContentItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentItemId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Approvals.Data.WorkspaceApprovalStepConfiguration", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Assets.Data.Asset", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.ContentItems.Data.ContentItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentItemId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Assets.Data.AssetRevision", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Assets.Data.Asset", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("AssetId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.CalendarIntegrations.Data.CalendarEvent", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.CalendarIntegrations.Data.CalendarSource", null)
|
||||
@@ -1865,6 +1948,104 @@ namespace Socialize.Api.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Campaigns.Data.Campaign", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Clients.Data.Client", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Channels.Data.Channel", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Clients.Data.Client", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Comments.Data.Comment", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.ContentItems.Data.ContentItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentItemId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Comments.Data.Comment", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentCommentId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.ContentItems.Data.ContentItem", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Campaigns.Data.Campaign", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CampaignId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Clients.Data.Client", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.ContentItems.Data.ContentItemActivityEntry", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.ContentItems.Data.ContentItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentItemId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.ContentItems.Data.ContentItemRevision", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.ContentItems.Data.ContentItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentItemId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Feedback.Data.FeedbackActivityEntry", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Feedback.Data.FeedbackReport", "FeedbackReport")
|
||||
@@ -1887,6 +2068,29 @@ namespace Socialize.Api.Migrations
|
||||
b.Navigation("FeedbackReport");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Feedback.Data.FeedbackReport", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Campaigns.Data.Campaign", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CampaignId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Clients.Data.Client", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.ContentItems.Data.ContentItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentItemId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Feedback.Data.FeedbackScreenshot", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Feedback.Data.FeedbackReport", "FeedbackReport")
|
||||
@@ -1909,6 +2113,20 @@ namespace Socialize.Api.Migrations
|
||||
b.Navigation("FeedbackReport");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Notifications.Data.NotificationEvent", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.ContentItems.Data.ContentItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentItemId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Organizations.Data.OrganizationMembership", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Organizations.Data.Organization", null)
|
||||
@@ -1927,6 +2145,15 @@ namespace Socialize.Api.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Workspaces.Data.WorkspaceInvite", b =>
|
||||
{
|
||||
b.HasOne("Socialize.Api.Modules.Workspaces.Data.Workspace", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WorkspaceId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Socialize.Api.Modules.Feedback.Data.FeedbackReport", b =>
|
||||
{
|
||||
b.Navigation("ActivityEntries");
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Socialize.Api.Modules.ContentItems.Data;
|
||||
using Socialize.Api.Modules.Workspaces.Data;
|
||||
|
||||
namespace Socialize.Api.Modules.Approvals.Data;
|
||||
|
||||
@@ -20,6 +22,14 @@ internal static class ApprovalModelConfiguration
|
||||
workflowInstance.HasIndex(x => new { x.ContentItemId, x.State })
|
||||
.IsUnique()
|
||||
.HasFilter("\"State\" = 'Pending'");
|
||||
workflowInstance.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
workflowInstance.HasOne<ContentItem>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ContentItemId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ApprovalRequest>(approvalRequest =>
|
||||
@@ -40,6 +50,18 @@ internal static class ApprovalModelConfiguration
|
||||
approvalRequest.HasIndex(x => x.ContentItemId);
|
||||
approvalRequest.HasIndex(x => x.WorkflowInstanceId);
|
||||
approvalRequest.HasIndex(x => x.ReviewerEmail);
|
||||
approvalRequest.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
approvalRequest.HasOne<ContentItem>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ContentItemId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
approvalRequest.HasOne<ApprovalWorkflowInstance>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkflowInstanceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ApprovalDecision>(approvalDecision =>
|
||||
@@ -54,6 +76,10 @@ internal static class ApprovalModelConfiguration
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
approvalDecision.HasIndex(x => x.ApprovalRequestId);
|
||||
approvalDecision.HasOne<ApprovalRequest>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ApprovalRequestId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WorkspaceApprovalStepConfiguration>(approvalStep =>
|
||||
@@ -69,6 +95,10 @@ internal static class ApprovalModelConfiguration
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
approvalStep.HasIndex(x => x.WorkspaceId);
|
||||
approvalStep.HasIndex(x => new { x.WorkspaceId, x.SortOrder }).IsUnique();
|
||||
approvalStep.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Socialize.Api.Modules.ContentItems.Data;
|
||||
using Socialize.Api.Modules.Workspaces.Data;
|
||||
|
||||
namespace Socialize.Api.Modules.Assets.Data;
|
||||
|
||||
@@ -21,6 +23,14 @@ internal static class AssetModelConfiguration
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
asset.HasIndex(x => x.WorkspaceId);
|
||||
asset.HasIndex(x => x.ContentItemId);
|
||||
asset.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
asset.HasOne<ContentItem>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ContentItemId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AssetRevision>(revision =>
|
||||
@@ -35,6 +45,10 @@ internal static class AssetModelConfiguration
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
revision.HasIndex(x => x.AssetId);
|
||||
revision.HasIndex(x => new { x.AssetId, x.RevisionNumber }).IsUnique();
|
||||
revision.HasOne<Asset>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.AssetId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Socialize.Api.Modules.Clients.Data;
|
||||
using Socialize.Api.Modules.Workspaces.Data;
|
||||
|
||||
namespace Socialize.Api.Modules.Campaigns.Data;
|
||||
|
||||
@@ -20,6 +22,14 @@ internal static class CampaignModelConfiguration
|
||||
campaign.HasIndex(x => new { x.ClientId, x.Name }).IsUnique();
|
||||
campaign.HasIndex(x => x.WorkspaceId);
|
||||
campaign.HasIndex(x => x.ClientId);
|
||||
campaign.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
campaign.HasOne<Client>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ClientId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Socialize.Api.Modules.Workspaces.Data;
|
||||
|
||||
namespace Socialize.Api.Modules.Channels.Data;
|
||||
|
||||
@@ -19,6 +20,10 @@ internal static class ChannelModelConfiguration
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
channel.HasIndex(x => x.WorkspaceId);
|
||||
channel.HasIndex(x => new { x.WorkspaceId, x.Network, x.Name }).IsUnique();
|
||||
channel.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Socialize.Api.Modules.Workspaces.Data;
|
||||
|
||||
namespace Socialize.Api.Modules.Clients.Data;
|
||||
|
||||
@@ -21,6 +22,10 @@ internal static class ClientModelConfiguration
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
client.HasIndex(x => new { x.WorkspaceId, x.Name }).IsUnique();
|
||||
client.HasIndex(x => x.WorkspaceId);
|
||||
client.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Socialize.Api.Modules.ContentItems.Data;
|
||||
using Socialize.Api.Modules.Workspaces.Data;
|
||||
|
||||
namespace Socialize.Api.Modules.Comments.Data;
|
||||
|
||||
@@ -24,6 +26,18 @@ internal static class CommentModelConfiguration
|
||||
comment.HasIndex(x => x.WorkspaceId);
|
||||
comment.HasIndex(x => x.ContentItemId);
|
||||
comment.HasIndex(x => x.ParentCommentId);
|
||||
comment.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
comment.HasOne<ContentItem>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ContentItemId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
comment.HasOne<Comment>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ParentCommentId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Socialize.Api.Modules.Campaigns.Data;
|
||||
using Socialize.Api.Modules.Clients.Data;
|
||||
using Socialize.Api.Modules.Workspaces.Data;
|
||||
|
||||
namespace Socialize.Api.Modules.ContentItems.Data;
|
||||
|
||||
@@ -22,6 +25,18 @@ internal static class ContentItemModelConfiguration
|
||||
contentItem.HasIndex(x => x.WorkspaceId);
|
||||
contentItem.HasIndex(x => x.ClientId);
|
||||
contentItem.HasIndex(x => x.CampaignId);
|
||||
contentItem.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
contentItem.HasOne<Client>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ClientId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
contentItem.HasOne<Campaign>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.CampaignId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ContentItemRevision>(revision =>
|
||||
@@ -39,6 +54,10 @@ internal static class ContentItemModelConfiguration
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
revision.HasIndex(x => x.ContentItemId);
|
||||
revision.HasIndex(x => new { x.ContentItemId, x.RevisionNumber }).IsUnique();
|
||||
revision.HasOne<ContentItem>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ContentItemId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ContentItemActivityEntry>(entry =>
|
||||
@@ -56,6 +75,14 @@ internal static class ContentItemModelConfiguration
|
||||
entry.HasIndex(x => x.WorkspaceId);
|
||||
entry.HasIndex(x => x.ContentItemId);
|
||||
entry.HasIndex(x => new { x.ContentItemId, x.CreatedAt });
|
||||
entry.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
entry.HasOne<ContentItem>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ContentItemId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Socialize.Api.Modules.Campaigns.Data;
|
||||
using Socialize.Api.Modules.Clients.Data;
|
||||
using Socialize.Api.Modules.ContentItems.Data;
|
||||
using Socialize.Api.Modules.Workspaces.Data;
|
||||
|
||||
namespace Socialize.Api.Modules.Feedback.Data;
|
||||
|
||||
@@ -29,6 +33,22 @@ internal static class FeedbackModelConfiguration
|
||||
feedback.HasIndex(x => x.Type);
|
||||
feedback.HasIndex(x => x.WorkspaceId);
|
||||
feedback.HasIndex(x => x.LastActivityAt);
|
||||
feedback.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
feedback.HasOne<Client>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ClientId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
feedback.HasOne<Campaign>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.CampaignId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
feedback.HasOne<ContentItem>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ContentItemId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<FeedbackTag>(tag =>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Socialize.Api.Modules.ContentItems.Data;
|
||||
using Socialize.Api.Modules.Workspaces.Data;
|
||||
|
||||
namespace Socialize.Api.Modules.Notifications.Data;
|
||||
|
||||
@@ -22,6 +24,14 @@ internal static class NotificationModelConfiguration
|
||||
notificationEvent.HasIndex(x => x.ContentItemId);
|
||||
notificationEvent.HasIndex(x => x.RecipientUserId);
|
||||
notificationEvent.HasIndex(x => x.CreatedAt);
|
||||
notificationEvent.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
notificationEvent.HasOne<ContentItem>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.ContentItemId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
|
||||
@@ -41,6 +41,10 @@ internal static class WorkspaceModelConfiguration
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
workspaceInvite.HasIndex(x => x.WorkspaceId);
|
||||
workspaceInvite.HasIndex(x => new { x.WorkspaceId, x.Email, x.Status });
|
||||
workspaceInvite.HasOne<Workspace>()
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorkspaceId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
|
||||
Reference in New Issue
Block a user