Fix SimplifySearchVectorExpressionCommand (#8218)

## Context
This command was introduced to simplify searchVector expressions that
were added in v0.31.x for existing workspaces.
New search vector columns have been added later during 0.32 development
and should not be migrated, this actually breaks the command because we
run sync-metadata before the upgrade command.

The fix removes the throw since this is expected and return early if the
search vector was not matched with an object that needs migration.

## Test
checkout v0.31.0
reset:db command
checkout this PR
run typeorm migrations
run upgrade 0-32 command
This commit is contained in:
Weiko 2024-10-30 17:47:52 +01:00 committed by GitHub
parent c7c16f7114
commit d19bc2c224
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -79,11 +79,10 @@ export class SimplifySearchVectorExpressionCommand extends ActiveWorkspacesComma
fieldsUsedForSearch = SEARCH_FIELDS_FOR_OPPORTUNITY;
break;
}
default: {
throw new Error(
`search vector has unexpected standardId: ${searchVectorField.standardId}`,
);
}
}
if (fieldsUsedForSearch.length === 0) {
continue;
}
await this.searchService.updateSearchVector(