Description
Issue description
Syncronise: true messes up stuff after first run (tries to recreate db and fails)
Expected Behavior
To work after restarts.
Should be obvious, aka not to recreate the schema since nothing's changed.
Note: I think should happen in migrations as well....
Actual Behavior
query: ALTER TABLE orders
ADD id
varchar(36) NOT NULL PRIMARY KEY
query failed: ALTER TABLE orders
ADD id
varchar(36) NOT NULL PRIMARY KEY
error: Error: Duplicate entry '' for key 'orders.PRIMARY'
query: ROLLBACK
[Nest] 651697 - 05/30/2023, 11:04:50 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)...
QueryFailedError: Duplicate entry '' for key 'orders.PRIMARY'
Steps to reproduce
See sample project.
But in general start app with synchronize: true and restart it.
(It also happens when you start the app with sync: true an then try doing a migration, see migrations/ on sample repo)
My Environment
Dependency | Version |
---|---|
Operating System | linux / win |
Node.js version | v18.16.0 |
Typescript version | ^5.0.0 |
TypeORM version | 0.3.16 |
Additional Context
====> Sample Project
Relevant Database Driver(s)
- aurora-mysqlaurora-postgresbetter-sqlite3cockroachdbcordovaexpomongodbmysqlnativescriptoraclepostgresreact-nativesapspannersqlitesqlite-abstractsqljssqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, but I don't know how to start. I would need guidance.
Activity
N-Andronopoulos commentedon May 30, 2023
I think there a fix for it maybe? If it is please close this one :)
#10041
peter-rybar commentedon Jun 8, 2023
Still no fix? It is a critical issue!
Seems like TypeORM deal breaker.
Mateozmaldonado17 commentedon Jun 9, 2023
Omg, i had this issue for long time, so i was thinking that was something wrong with my code
peter-rybar commentedon Jun 11, 2023
OK guys, no fix still? Really?
slyk commentedon Jun 12, 2023
For me this helps right now (I got UUID generated in code, but maybe even without it it would work)
12 remaining items