nestjs / typeorm

TypeORM module for Nest framework (node.js) 🍇

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setting synchronize to true gives me a typeorm error

Mateozmaldonado17 opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

[Nest] 65393 - 06/13/2023, 9:54:15 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
QueryFailedError: ER_DUP_ENTRY: Duplicate entry '' for key 'role.PRIMARY'
at Query. (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/src/driver/mysql/MysqlQueryRunner.ts:222:33)
at Query. (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/node_modules/mysql/lib/Connection.js:526:10)
at Query._callback (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/node_modules/mysql/lib/Connection.js:488:16)
at Query.Sequence.end (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
at Query.ErrorPacket (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/node_modules/mysql/lib/protocol/sequences/Query.js:92:8)
at Protocol._parsePacket (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket. (/Users/mateozapatamaldonado/Documents/Apps.nosync/Personal/Authentication-Container/Authentication-Backend/node_modules/mysql/lib/Connection.js:88:28)
^C

Minimum reproduction code

https://gist.github.com/Mateozmaldonado17/997a764038cc55f28e424ea8720d95e3

Steps to reproduce

  1. npm run start:dev

Expected behavior

Update the database automatically

Package version

9.0.1

NestJS version

9.0.8

Node.js version

14.19.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

This would need to be reported to Typeorm directly. Nest does not dictate typeorm's internal functionality, this package just focuses on creating injection tokens for the library