Skip to content

Commit

Permalink
Add logs and fix timestamps in migrate domain command (twentyhq#6468)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijreilly authored Jul 31, 2024
1 parent 50f1cd3 commit 7fe00b1
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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.`,
);
Expand Down

0 comments on commit 7fe00b1

Please sign in to comment.