`No Value` view groups wasn't properly created when we select a group by field metadata, this PR fix the issue. Also a script is added to backfill the current view groups. --------- Co-authored-by: Marie <51697796+ijreilly@users.noreply.github.com>
55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
import { InjectRepository } from '@nestjs/typeorm';
|
|
|
|
import { Command } from 'nest-commander';
|
|
import { Repository } from 'typeorm';
|
|
|
|
import { ActiveWorkspacesCommandRunner } from 'src/database/commands/active-workspaces.command';
|
|
import { BaseCommandOptions } from 'src/database/commands/base.command';
|
|
import { RecordPositionBackfillCommand } from 'src/database/commands/upgrade-version/0-40/0-40-record-position-backfill.command';
|
|
import { ViewGroupNoValueBackfillCommand } from 'src/database/commands/upgrade-version/0-40/0-40-view-group-no-value-backfill.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';
|
|
|
|
@Command({
|
|
name: 'upgrade-0.40',
|
|
description: 'Upgrade to 0.40',
|
|
})
|
|
export class UpgradeTo0_40Command extends ActiveWorkspacesCommandRunner {
|
|
constructor(
|
|
@InjectRepository(Workspace, 'core')
|
|
protected readonly workspaceRepository: Repository<Workspace>,
|
|
private readonly recordPositionBackfillCommand: RecordPositionBackfillCommand,
|
|
private readonly viewGroupNoValueBackfillCommand: ViewGroupNoValueBackfillCommand,
|
|
private readonly syncWorkspaceMetadataCommand: SyncWorkspaceMetadataCommand,
|
|
) {
|
|
super(workspaceRepository);
|
|
}
|
|
|
|
async executeActiveWorkspacesCommand(
|
|
passedParam: string[],
|
|
options: BaseCommandOptions,
|
|
workspaceIds: string[],
|
|
): Promise<void> {
|
|
await this.recordPositionBackfillCommand.executeActiveWorkspacesCommand(
|
|
passedParam,
|
|
options,
|
|
workspaceIds,
|
|
);
|
|
|
|
await this.viewGroupNoValueBackfillCommand.executeActiveWorkspacesCommand(
|
|
passedParam,
|
|
options,
|
|
workspaceIds,
|
|
);
|
|
|
|
await this.syncWorkspaceMetadataCommand.executeActiveWorkspacesCommand(
|
|
passedParam,
|
|
{
|
|
...options,
|
|
force: true,
|
|
},
|
|
workspaceIds,
|
|
);
|
|
}
|
|
}
|