margelo / margelo/react-native-nitro-sqlite

changing location property is not showing the DB

Open
#19 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage:needs-reproduction
Dominant language
C
Stars
565
Forks
53
Avg merge
1d 21h
Merged PRs (30d)
18

Description

I am trying to save the DB file inside the App Data folder (e.g. /storage/emulated/0/Android/data/com.package.name). And I have this code:

// other imports
import { QuickSQLiteConnection, open } from "react-native-quick-sqlite";

// get the app directory
const externalDirectory = RNFS.ExternalDirectoryPath; // --> /storage/emulated/0/Android/data/com.package.name/files location

// open the db
const db = open({ name: "default.db", location: externalDirectory });

This opens the DB fine, I am not able to see any file inside the above mentioned location. And, if I change the location property to any other directory (e.g. RNFS.DownloadDirectoryPath), this also not showing any DB, but if I revert to old location, I still have the older data.

My requirement is that I want to give an option to the user to export (backup) the local database, so that they can import it later, or onto any other devices. How can I achieve this?

Thank you in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the open({ name: "default.db", location: externalDirectory }) call and trace how the Android location is handled. Reproduce it with RNFS.ExternalDirectoryPath and RNFS.DownloadDirectoryPath, then determine the supported backup and import workflow or the conditions under which location changes take effect. No repository file or test is named, and done is not defined beyond making export and import possible.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native, sqlite
Domain
databases, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.