bra*_*rke 3 postgresql node.js typescript typeorm nestjs
当将第一个管理员插入我的数据库时,我收到此错误消息,但不知道如何解决它:
[Nest] 13803 - 04/27/2021, 23:03:02 [TypeOrmModule] Unable to connect to the database. Retrying (6)... +3176ms
QueryFailedError: column "name" of relation "admin" contains null values
Run Code Online (Sandbox Code Playgroud)
到目前为止,其他表工作得很好并且没有错误。
注册服务:
async register(registerInput: RegisterInput): Promise<void> {
const { key, name, password, email } = registerInput;
const hashedKey = createHash('sha256')
.update(key)
.digest('hex');
const invite = await this.invitesRepository.findOne({ key: hashedKey });
if (!invite) {
throw new UnauthorizedException();
}
const newAdmin = await this.adminsRepository.create({
name,
password,
email,
});
await this.adminsRepository.save(newAdmin);
await this.invitesRepository.delete({ id: invite.id });
}
Run Code Online (Sandbox Code Playgroud)
我删除了dist目录并重建了代码。这解决了这个问题。
| 归档时间: |
|
| 查看次数: |
2776 次 |
| 最近记录: |