Hive: Moving boxes to another device

Created on 4 Dec 2020  路  4Comments  路  Source: hivedb/hive

Question
We have the same app running on multiple devices entering data into forms.
We would like to synchronize changes in forms on the remote devices to a master tablet.
My team has been doing a conversion to Box -> SON, transport JSON, JSON->BOX, merge.

I wonder why can't we just move the boxes, open them up on the receiving end, merge differences.

We are basically writing stuff to boxes and writing equivalent code to write / read into JSON, and I wonder why not just do it once?

Version
Android/ioS
Latest version of flutter and hive.

Thanks,

Ken Nelson

question

All 4 comments

You can also transfer box file, read & parse on other end then copy data to the box on endpoint.

@TheMisir I'm currently trying to move the full boxes to a backup location and restore/overwrite the full boxes on request.
Converting box.values or box.toMap() to JSON currently seems a lot of unnecessary work (since I'm storing custom data models), if there would be any way to just get a hold of the full box-files or box-file-contents as a single string (being on iOS/Android). Do you have any hints for me?

You can copy database file itself. The .hive files is stored in getApplicationDocumentsDirectory() directory.

Just in case anyone looking for way to do it in a "string"-way when copying isn't the best option:
https://github.com/hivedb/hive/issues/173#issuecomment-776052867

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NourEldinShobier picture NourEldinShobier  路  3Comments

kaboc picture kaboc  路  3Comments

Hopheylalal picture Hopheylalal  路  4Comments

sergiyvergun picture sergiyvergun  路  4Comments

juandiago picture juandiago  路  4Comments