typeorm: Update to 0.2.5 breaking things
Issue type:
[X ] question [ ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[X ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
TypeORM version:
[ X] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (2 by maintainers)
@RDeluxe I had the same error popping up when the data in the tables looked perfect. Your comment about the query actually trying to create the column helped me find the issue. Do you have
synchronize: truein yourormconfig.json? If so, every time you run the app typeorm tries to recreate the tables and since you have data in there, throws that misleading error. @pleerock should I report it as an issue?To solve this issue, delete the entire dist folder and try again. Hopefully it works for you as well. Let us know if this did the trick.
Not sure if I should be opening a new issue or ask to reopen this one, I’m encountering the same behavior.
The error :
Thing is, I have no null value in the column “slug”, not do I have duplicates. I checked the existence of duplicates with the following command :
Seems to me that the combo
NOT NULL+UNIQUE, which is preventing us to use a default value, is causing this bug.Edit : it seems that it’s trying to add the column instead of altering it ? But the error does not concur
What’s up with this issue now? it’s still happening. I got a table with data called
categoriesthere’s nonulldata in it in none of the columns, it says:I tried doing this in the category.entity class:
It auto updated all
namestrings toNULL, stupid feature isn’t it? Settingsyncronize: falseis solving it, but in production won’t it throw the same error when matching the entity to table with content? Also, why shall we turn off syncronization if that feature is there?I had the same bug, when I was going to add a column in the “user” table the solution was to warn that initially the column will be null, unfortunately I could not add a fixed value when creating it, as it generated some errors. Here’s the example that worked for me:
I had this issue and it can be fixed indeed as the community mentioned by setting
Synchronize: falsebut also it can happen if you try to save data that has any type of relationship before saving its corresponding relation. e.g: Category and Question, one question has multiple categories so you try to save the question without saving first the categories if they don’t exist already in the database.Same problem here.
@younusmahmood
Please re-open the issue, because it seems that the devs here don’t take this issue serious. I am having the same problem with @Alain1405 @RDeluxe.