Add logs and fix timestamps in migrate domain command (#6468)

This commit is contained in:
Marie
2024-07-31 11:23:19 +02:00
committed by GitHub
parent 50f1cd352d
commit 7fe00b163e

View File

@ -130,12 +130,17 @@ export class MigrateDomainNameFromTextToLinksCommand extends CommandRunner {
await workspaceQueryRunner.connect();
const fieldName = domainNameField.name;
const { id: _id, ...domainNameFieldWithoutId } = domainNameField;
const {
id: _id,
createdAt: _createdAt,
updatedAt: _updatedAt,
...domainNameFieldWithoutIdAndTimestamps
} = domainNameField;
try {
const tmpNewDomainLinksField =
await this.fieldMetadataService.createOne({
...domainNameFieldWithoutId,
...domainNameFieldWithoutIdAndTimestamps,
type: FieldMetadataType.LINKS,
name: `${fieldName}Tmp`,
defaultValue: {
@ -207,6 +212,7 @@ export class MigrateDomainNameFromTextToLinksCommand extends CommandRunner {
this.logger.log(`Migration of domainName done!`);
} catch (error) {
this.logger.log(`Error: ${error.message}`);
this.logger.log(
`Failed to migrate domainName ${domainNameField.id}, rolling back.`,
);