Closed patrickschmelter closed 6 years ago
What version of TypeORM are you using?
If you are using next
where is a known and fixed bug that occurs when inserting columns with the cordova driver. This issue has been fixed in this pull request. But as far as I know, no new alpha release was made since then.
Thats good news, I'm on 0.2.0-alpha.28
currently
I just checked, that's the latest version, which was released before the fix. This means, that you will have to wait for the next alpha release
0.2.0-alpha.29
should be available including the fix for your issue.
@patrickschmelter if you still encounter this bug, feel free to reopen the issue
Hey,
I have build and tested an app in chrome browser, where it runs smoothly. The problem is that keys won't be set on real devices. Tested using iOS 11.2.6 and Android 7.1.1.
Sample Code: City Entity
Tour Entity
Tables are correctly generated:
Connecting and inserting into the database:
In the insert statements notice the NULL at the point where the foreign key should be, also the city should have an id at this point:
Loading the relation obviously fails:
or alternatively
The output is:
console.log: cities loaded:[{"id":1,"name":"City","tours":[]}]
Interestingly the city has an id here.Manually adding the cityId as Column to the tour entity and setting it does not work either:
Device output:
Whereas the browser output looks as follows. On device the SELECT last_insert_rowid() is not called:
Seems to be a problem with creating a primary key, as everything else is working as expected when I set it manually:
Device Output: