HI @developernotes,
I have checked options provided in Update to version 4
We have released Production app with SQLCipher v3.5.7 now we are upgrading the library to 4.1.3
so before onUpgrade method gets invoke it crashes
can you please let me know how do we need to execute “PRAGMA cipher_migrate”?
I have followed example given in link : Example Link
Hi @gupta126
You can perform the cipher_migrate
command via a SQLiteDatabaseHook
within the postKey
operation. An example from our test suite can be found here.
HI @developernotes,
As in given test suite I got to know that by using performing cipher_migrate
script using SQLiteDatabaseHook
will migrate database.
Usecase: I have already published App with database v 1.0 and now App will get publish with database v 2, Now when app is gets updated OnUpgrade method get invoke where I am calling this cipher_migrate
script but before that it gets crash
so can you please suggest a way to achieve above usecase?
Hi @gupta126
The SQLiteOpenHelper
constructor will take a SQLiteDatabaseHook
as a parameter which can be used to perform your pragma cipher_migrate
operation.
Hi @developernotes,
Thanks for the update, as you mention I can use SQLiteDatabaseHook
as a parameter but, once the migration is successful then still it will call every time when instance will be created it so it might be a not good idea to use it in the constructor.
Hello @gupta126
That is correct that you do not want to attempt the migration every time you open a connection. We recommend that you track the database file format upgrade state separately.