react-native-sqlite-2 icon indicating copy to clipboard operation
react-native-sqlite-2 copied to clipboard

database not persisting when doing a phone transfer

Open chrisdrackett opened this issue 4 years ago • 6 comments

I just did a phone-to-phone transfer on iOS 15 and found that my DB didn't make it to the new phone. I'm in the process of seeing if this is also the case for an iCloud transfer as well.

I haven't looked too deeply into this yet, but did find the following: https://github.com/craftzdog/react-native-sqlite-2/blob/7d8dfaa51ad1f4ba03c67629fbf18e6a223fd1a4/ios/RNSqlite2.m#L64

Does this mean that this library does not put the database somewhere that will be syncable? Curious about the reasoning here as we really want to make sure that a users database is backed up to iCloud and will make it through a device to device transfer.

chrisdrackett avatar Sep 24 '21 20:09 chrisdrackett

I'm not sure why but the code has come from this commit: https://github.com/nolanlawson/cordova-plugin-sqlite-2/commit/bd8ec1c1e2315c4b2a657010f7573f886a4872ab Related issue: https://github.com/nolanlawson/cordova-plugin-sqlite-2/issues/80

craftzdog avatar Sep 25 '21 04:09 craftzdog

I suggest making this optional and allowing backups by default

gaodeng avatar Sep 25 '21 05:09 gaodeng

I've updated my issue nolanlawson/cordova-plugin-sqlite-2#80 with a response from Apple about NSURLIsExcludedFromBackupKey here.

I think it is safe to remove NSURLIsExcludedFromBackupKey to allow for backups, but I'm not sure if it's necessary to change the directory itself from noCloud to something else.

knubie avatar Oct 13 '21 02:10 knubie

I just changed this to the directory that the apple docs suggest. I feel like I read that the noCloud directory is not backed up regardless of flag.

chrisdrackett avatar Oct 13 '21 03:10 chrisdrackett

@chrisdrackett Could you share a link to the Apple docs you're referring to?

knubie avatar Oct 14 '21 02:10 knubie

I can't seem to find it outside of Cordova docs, so I doubt that's true. Regardless, seems odd to store files that are backed up to the cloud in a "NoCloud" folder for new installations at least.

chrisdrackett avatar Oct 14 '21 16:10 chrisdrackett