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