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:
@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddUniqueConstraintOnUsers1726849473832 implements MigrationInterface {
|
||||
name = 'AddUniqueConstraintOnUsers1726849473832'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "core"."user" ADD CONSTRAINT "UQ_USER_EMAIL" UNIQUE ("email", "deletedAt")`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "core"."user" DROP CONSTRAINT "UQ_USER_EMAIL"`);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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')
|
||||
|
||||
Reference in New Issue
Block a user