Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Phones migration](fix) update label of standard field by using raw query #7255

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

ijreilly
Copy link
Collaborator

No description provided.

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This pull request updates the phone fields migration process, specifically focusing on updating the label of the standard person phone field using a raw SQL query.

  • Modified packages/twenty-server/src/database/commands/upgrade-version/0-32/0-32-migrate-phone-fields-to-phones.command.ts to use a raw query for updating the standard person phone field label
  • Replaced fieldMetadataService.updateOne() with a direct SQL update statement to avoid potential side effects
  • Added error handling for the raw query execution to ensure robustness
  • Improved migration reliability by bypassing service-level hooks and validations

1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings

Comment on lines +184 to +187
await this.metadataDataSource.query(
`UPDATE "metadata"."fieldMetadata" SET "label" = $1 where "id"=$2`,
['Phone (deprecated)', standardPersonPhoneField.id],
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Using raw SQL query instead of fieldMetadataService. Ensure this doesn't bypass important logic or triggers.

Comment on lines +259 to +262
await this.metadataDataSource.query(
`UPDATE "metadata"."fieldMetadata" SET "label" = $1 where "id"=$2`,
['Phone', standardPersonPhoneField.id],
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Same raw SQL approach used here. Consider consistency with other field updates in the codebase.

@ijreilly ijreilly merged commit e1cb82b into main Sep 25, 2024
4 of 5 checks passed
@ijreilly ijreilly deleted the fix-label-standard-field branch September 25, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants