Menu

Migrating from hive to hive_ce? typeId 224 is a one-way door
📰

Migrating from hive to hive_ce? typeId 224 is a one-way door

DEV Community: dart·Stacklyn Labs·3 days ago
#9LEU9AM1
#devtodart#devto#dev#typeid#hive
Reading 0:00
15s threshold

hive_ce is the community continuation of Hive v2, and moving to it is mostly a dependency swap. Most of the time you can even roll back. But there are two typeId details that decide whether a rollback is possible, and whether the upgrade throws on day one.

Rolling back works, up to typeId 223

Original Hive caps custom typeIds at 223 . hive_ce 2.10.0 raised the limit to 65439 .

In our tests, data that hive_ce wrote with the same models and plain types read back correctly in hive 2.2.3. So if the migration goes wrong, you can go back.

Until you use a typeId above 223.

What happens above 223

Once you register an adapter above 223 and write with it, the original package can no longer read that box. We tested typeId 300 in hive 2.2.3 and got two different failures.

Registering the adapter:

HiveError: TypeId 300 not allowed.

Enter fullscreen mode

Exit fullscreen mode

Opening the box without it:

HiveError: Cannot read, unknown typeId: 21.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.