Reputation: 459
When inserting first admin into my database I get this error message and don't know how to solve it:
[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
Other tables work just fine so far and without errors.
Column name
in admin
table is not null it contains value:
Register service:
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 });
}
Upvotes: 3
Views: 3190
Reputation: 459
I deleted dist
directory and rebuilt the code. This solved the issue.
Upvotes: 7