feat: sync command missing ability to rename standard object (#4819)

We've introduced in PR #4373 standard ids to be able to rename standard
fields and objects.
Fields part was working properly, but objects part was not yet
implemented.
This PR is adding the missing parts to make it work.
This commit is contained in:
Jérémy M
2024-04-09 10:20:34 +02:00
committed by GitHub
parent b1242bb850
commit 35717fce8b
16 changed files with 322 additions and 148 deletions

View File

@ -42,27 +42,39 @@ export class SyncWorkspaceMetadataCommand extends CommandRunner {
: await this.workspaceService.getWorkspaceIds();
for (const workspaceId of workspaceIds) {
const issues = await this.workspaceHealthService.healthCheck(workspaceId);
try {
const issues =
await this.workspaceHealthService.healthCheck(workspaceId);
// Security: abort if there are issues.
if (issues.length > 0) {
// Security: abort if there are issues.
if (issues.length > 0) {
if (!options.force) {
this.logger.error(
`Workspace contains ${issues.length} issues, aborting.`,
);
this.logger.log(
'If you want to force the migration, use --force flag',
);
this.logger.log(
'Please use `workspace:health` command to check issues and fix them before running this command.',
);
return;
}
this.logger.warn(
`Workspace contains ${issues.length} issues, sync has been forced.`,
);
}
} catch (error) {
if (!options.force) {
this.logger.error(
`Workspace contains ${issues.length} issues, aborting.`,
);
this.logger.log(
'If you want to force the migration, use --force flag',
);
this.logger.log(
'Please use `workspace:health` command to check issues and fix them before running this command.',
);
return;
throw error;
}
this.logger.warn(
`Workspace contains ${issues.length} issues, sync has been forced.`,
`Workspace health check failed with error, but sync has been forced.`,
error,
);
}