Add command to remove duplicate messageChannelMessageAssociations (#9886)
In this PR: - create a command to remove duplicate (groupBy messageId, messageChannelId) within messageChannelmessageAssociaitions. THis is needed to apply a constraint already present on messageChannelmessageAssociaitions (to be executed before syncing metadata)
This commit is contained in:
@ -6,6 +6,7 @@ import { Repository } from 'typeorm';
|
||||
import { ActiveWorkspacesCommandRunner } from 'src/database/commands/active-workspaces.command';
|
||||
import { BaseCommandOptions } from 'src/database/commands/base.command';
|
||||
import { MigrateRelationsToFieldMetadataCommand } from 'src/database/commands/upgrade-version/0-41/0-41-migrate-relations-to-field-metadata.command';
|
||||
import { RemoveDuplicateMcmasCommand } from 'src/database/commands/upgrade-version/0-41/0-41-remove-duplicate-mcmas';
|
||||
import { SeedWorkflowViewsCommand } from 'src/database/commands/upgrade-version/0-41/0-41-seed-workflow-views.command';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { SyncWorkspaceMetadataCommand } from 'src/engine/workspace-manager/workspace-sync-metadata/commands/sync-workspace-metadata.command';
|
||||
@ -21,6 +22,7 @@ export class UpgradeTo0_41Command extends ActiveWorkspacesCommandRunner {
|
||||
private readonly seedWorkflowViewsCommand: SeedWorkflowViewsCommand,
|
||||
private readonly syncWorkspaceMetadataCommand: SyncWorkspaceMetadataCommand,
|
||||
private readonly migrateRelationsToFieldMetadata: MigrateRelationsToFieldMetadataCommand,
|
||||
private readonly removeDuplicateMcmasCommand: RemoveDuplicateMcmasCommand,
|
||||
) {
|
||||
super(workspaceRepository);
|
||||
}
|
||||
@ -32,6 +34,12 @@ export class UpgradeTo0_41Command extends ActiveWorkspacesCommandRunner {
|
||||
): Promise<void> {
|
||||
this.logger.log('Running command to upgrade to 0.41');
|
||||
|
||||
await this.removeDuplicateMcmasCommand.executeActiveWorkspacesCommand(
|
||||
passedParam,
|
||||
options,
|
||||
workspaceIds,
|
||||
);
|
||||
|
||||
await this.syncWorkspaceMetadataCommand.executeActiveWorkspacesCommand(
|
||||
passedParam,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user