# Migrating from SQLCipher 3.5.1 to 4.1.3 in Android

**URL:** <https://discuss.zetetic.net/t/migrating-from-sqlcipher-3-5-1-to-4-1-3-in-android/3652>\
**Category:** Issues\
**Created:** [May 9, 2019, 4:04pm UTC](https://discuss.zetetic.net/t/migrating-from-sqlcipher-3-5-1-to-4-1-3-in-android/3652 "2019-05-09T16:04:56Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![petrakeas](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/petrakeas/32/1057_2.png) [@petrakeas](https://discuss.zetetic.net/u/petrakeas)\
**Post date:** [May 14, 2019, 11:06am UTC](https://discuss.zetetic.net/t/migrating-from-sqlcipher-3-5-1-to-4-1-3-in-android/3652/5 "2019-05-14T11:06:35Z")

</div>

Hi Nick,

If I understand correctly you are proposing what I already described in my previous comment.

Using `openDatabase()` with `CREATE_IF_NECESSARY` before passing `"PRAGMA cipher_migrate"`, migrates the DB successfully.

From your answer it seems that `CREATE_IF_NECESSARY` is needed so that the temporary DB is created.

I think it would be a good idea for the [migration guide](https://discuss.zetetic.net/t/upgrading-to-sqlcipher-4/3283) to be updated, to point that this flag (`CREATE_IF_NECESSARY`), or that the `openOrCreateDatabase()` method are required for the migration to succeed.

---

_[View the full topic](https://discuss.zetetic.net/t/migrating-from-sqlcipher-3-5-1-to-4-1-3-in-android/3652)._
