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

Fix unique index email people #7713

Merged
merged 1 commit into from
Oct 15, 2024
Merged

Fix unique index email people #7713

merged 1 commit into from
Oct 15, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Oct 15, 2024

Context

WorkspaceIsUnique decorator allows us to create unique indexes on our tables. Here Emails is a composite field containing a TEXT subfield. Due to the fact that TEXT fields are non-nullable and have empty strings as default values, adding a unique index on a TEXT field or any composite containing TEXT as subfields will fail and throw if we try to create more than 1 record that does not specify a value to the TEXT field.

This PR simply removes the index for the time being until we find a solution

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 addresses an issue with the unique index on the 'emails' field in the PersonWorkspaceEntity by temporarily removing the @WorkspaceIsUnique decorator.

  • Commented out @WorkspaceIsUnique decorator for 'emails' field in packages/twenty-server/src/modules/person/standard-objects/person.workspace-entity.ts
  • Removal of unique index may allow duplicate email entries in the database
  • Temporary fix until a solution for handling TEXT fields with empty string defaults is found
  • Potential impact on data integrity and uniqueness constraints for person records
  • Consider implementing application-level email validation to mitigate duplicate entries

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

@Weiko Weiko merged commit c061041 into main Oct 15, 2024
8 checks passed
@Weiko Weiko deleted the c--fix-unique-index-email-person branch October 15, 2024 09:31
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