Set a unique constraint on email table in users #7180 (#7184)

Link to issue - https://github.com/twentyhq/twenty/issues/7180

File changed -
twenty/packages/twenty-server/src/engine/core-modules/user/user.entity.ts

---------

Co-authored-by: subham sharma <subham.sharma@smartbear.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
Subham Sharma
2024-09-21 10:07:55 +05:30
committed by GitHub
parent 6d5d73fbe8
commit 4ed1eb581a
2 changed files with 17 additions and 1 deletions

View File

@ -9,7 +9,8 @@ import {
OneToMany,
PrimaryGeneratedColumn,
Relation,
UpdateDateColumn,
Unique,
UpdateDateColumn
} from 'typeorm';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
@ -27,6 +28,7 @@ registerEnumType(OnboardingStatus, {
@Entity({ name: 'user', schema: 'core' })
@ObjectType('User')
@Unique('UQ_USER_EMAIL', ['email', 'deletedAt'])
export class User {
@IDField(() => UUIDScalarType)
@PrimaryGeneratedColumn('uuid')