isar / hive

Lightweight and blazing fast key-value database written in pure Dart.
Apache License 2.0
4.11k stars 409 forks source link

TypeId is not consistent and how to safely remove adapter #1275

Open Lzyct opened 9 months ago

Lzyct commented 9 months ago

In our previous app version we registered adapter with typeId = 132. In the new version we completely remove that adapter but we are facing an issue when the user updates the app with the error message Cannot read, unknown typeId: 132.. To fix that we ignore that typeId because there is no function to remove registered adapter. But the new issue comes, if we ignore that typeId we get the error message HiveError: Cannot read, unknown typeId: 132. Did you forget to register an adapter? and when checking the log is directed to this adapter.

image

if you see that typeId is 131 but why Hive detect that adapter as 132

The steps to replicate that issue:

  1. Create an adapter with typeId = 132 called AdapterA
  2. Create an adapter with typeId = 131 called AdapterB
  3. Install the app and use that adapter
  4. Remove the AdapterA
  5. Ignore the typeId 132
  6. Run the project