craftzdog / react-native-sqlite-2

SQLite3 Native Plugin for React Native for iOS, Android, Windows and macOS.
Apache License 2.0
378 stars 87 forks source link

database not persisting when doing a phone transfer #105

Open chrisdrackett opened 3 years ago

chrisdrackett commented 3 years ago

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.

craftzdog commented 3 years ago

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

gaodeng commented 3 years ago

I suggest making this optional and allowing backups by default

knubie commented 2 years ago

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.

chrisdrackett commented 2 years ago

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.

knubie commented 2 years ago

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

chrisdrackett commented 2 years ago

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.