Step to reproduce:
// build with Hive 1.0.0
void main() async {
final directory = await getApplicationDocumentsDirectory();
Hive.init(directory.path);
final box = await Hive.openBox('LOCAL_STORAGE');
box.put('FOO', 'BAR');
runApp(MyApp());
}
// build with Hive 1.1.1
void main() async {
final directory = await getApplicationDocumentsDirectory();
Hive.init(directory.path);
final box = await Hive.openBox('LOCAL_STORAGE');
print(await box.get('FOO'));
runApp(MyApp());
}
md5-f3d02eb00ef7633febcdab5b1ecbda4b
Future<Box> get _box async {
await _hiveInitialization;
try {
return await Hive.openBox(_boxName);
} catch(e) {
File('$_hivePath/$_boxName.hive').delete();
return await Hive.openBox(_boxName);
}
}
Shit, I'm very sorry, this is a major bug that was not detected by the unit tests :(
The correct implementation would use lower case letters.
I'll close this for now as there is nothing I can do to undo that mistake...
Oh I thought you are going to close it after 1.2.0 but that's fine.
Do you have some timeline for 1.2.0?
We already handle the situation for now so not pushing, just a little info would be nice.
Also base on our current situation (some UPPERCASE.hive out there), do we need to do anything when upgrading to 1.2.0?
@Fantasycheese I'm still working on #94. 1.2.0 should be published in 1-2 weeks.
Unfortunately, 1.2.0 will be another breaking change for you. Everything will be how 1.0.0 did it.
@leisim Sure don't worry, as long as I know beforehand we should be fine. FYI previously we have some trouble adding any plugins in add-to-app structure on iOS so this library is a life saver for us, thanks!
Dev version of v1.2.0 published. I documented the new breaking change in the changelog.
馃槩 I published my app with 1.1.1 so my boxes are CamelCase.hive and CamelCase.lock. I've seen error logs consistent with https://github.com/hivedb/hive/issues/94. I decided to upgrade to 1.4.1+1 and I get can't open error. I've tried to programmatically rename the box files from CamelCase.hive to lower camelcase.hive.
@leisim are there any technical reasons renaming these files wouldn't work before opening them with Hive?