feat(ios): store databases in Application Support safely - #324
Open
chrispader wants to merge 5 commits into
Open
feat(ios): store databases in Application Support safely#324chrispader wants to merge 5 commits into
chrispader wants to merge 5 commits into
Conversation
The Documents directory becomes user-visible in the Files app when an app enables file sharing, exposing raw databases and their -wal/-shm journals to accidental sharing, modification, or deletion. Setting RNNitroSQLite_DatabaseLocation to "ApplicationSupport" in Info.plist stores databases in Library/Application Support instead (persistent, backed up, never user-visible). Databases created by older app versions are moved out of Documents when they are opened: the database and its journals are copied as a set before the originals are deleted, and if anything fails the database keeps being opened from Documents and the migration retries on the next open. Fixes #289 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
iOS apps that expose Documents through file sharing also expose Nitro SQLite databases, but moving those databases without every SQLite recovery file can corrupt data after a crash. #323 adds an opt-in Application Support location, but its migration omits rollback journals and only applies to databases passed through
open(). This replacement keeps Nicol谩s Bonet's original commit and adds complete recovery-file handling plus consistentopen(),attach(), anddrop()behavior.attach()and removes old or partial generations from both locations duringdrop().Reproduction
RNNitroSQLite_DatabaseLocationset toApplicationSupport.Fixes #289.
Supersedes #323.