我有一个带有唯一列的用户实体,称为电子邮件。当我尝试使用已经存在的电子邮件注册用户时,Nest.js崩溃了。我使用TypeORM btw。当然,我可以验证电子邮件,但这不应该是默认行为。
user.entity.ts列
@Column({ name: 'email', length: 300, nullable: true, unique: true })
private _email?: string;
登录
[Nest] 18176 - 2018-11-24 10:17:05 [ExceptionsHandler] SQLITE_CONSTRAINT: UNIQUE constraint failed: user.email +4491ms
QueryFailedError: SQLITE_CONSTRAINT: UNIQUE constraint failed: user.email
at new QueryFailedError (C:\Users\kvn\workspace\kargo-new-backend\src\error\QueryFailedError.ts:9:9)
at Statement.handler (C:\Users\kvn\workspace\kargo-new-backend\src\driver\sqlite\SqliteQueryRunner.ts:53:26)