Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: SQLiteConstraintException when inserting the same id item of hisotry/notes in room database. #3900

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

MohitMaliFtechiz
Copy link
Collaborator

Fixes #3899

  • ID is the primary key for notes/history and when there is an already id available in the room database, and if there is the same id present in the objectbox database and we try to put that entity in the room it gives the SQLiteConstraintException. To fix this we have modified our saving functions of history and notes. If there is already an ID that exists in the room database that we are trying to put in the database it will set the ID to 0 so that the room will automatically assign the ID to that entity and our history/notes will prevent it from being lost.
  • Added the test cases to properly test these scenarios.

…isotry/notes in room database.

* id is the primary key for notes/history and when there is an already id available in the room database, and if there is the same id present in the objectbox database and we try to put that entity in the room it gives the SQLiteConstraintException. To fix this we have modified our saving functions of history and notes. If there is already an ID that exists in the room database that we are trying to put in the database it will set the ID to 0 so that the room will automatically assign the ID to that entity and our history/notes will prevent to be lost.
* Added the test cases to properly test these scenarios.
@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as ready for review June 27, 2024 05:03
@kelson42 kelson42 merged commit e4c3d1a into main Jun 27, 2024
10 checks passed
@kelson42 kelson42 deleted the Fixes#3899 branch June 27, 2024 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLiteConstraintException when inserting the same id item of hisotry/notes in room database.
3 participants