greenDAO icon indicating copy to clipboard operation
greenDAO copied to clipboard

When using an encrypted database, onDowngrade is not supported, and the database will crash when it is downgraded

Open zhaolifan opened this issue 4 years ago • 1 comments

使用加密数据库时,通过getEncryptedWritableDb获取EncryptedHelper,EncryptedHelper不支持onDowngrade,数据库降级时会崩溃

When using an encrypted database, get the EncryptedHelper through getEncryptedWritableDb. EncryptedHelper does not support onDowngrade, and the database will crash when it is downgraded

zhaolifan avatar Jun 18 '20 11:06 zhaolifan

The greenDAO API is using a rather outdated version of the SQLite and SQLCipher APIs which did not support onDowngrade(), yet. A workaround is to write a custom open helper and manually call the relevant DaoMaster methods. Then pass whatever Database got created to DaoMaster(database).

greenrobot-team avatar Jun 22 '20 06:06 greenrobot-team