Closed finom closed 3 years ago
Hey @finom, you can use DB Browser for SQLite. https://sqlitebrowser.org/
@djorkaeffalexandre thank you but how can I open a DB which is in an emulator?
I think it's logged to someplace that I never saw. @radex where we can see this log? https://github.com/Nozbe/WatermelonDB/blob/876fe190f2dc57820780b11522c43d15b170f384/native/ios/WatermelonDB/Database.swift#L30
in the iOS system log -- e.g. via xcode
This comment can also help you all, at least for me it was https://github.com/Nozbe/WatermelonDB/issues/105#issuecomment-453815987
@radex I'm thinking about creating a reference for that on the documentation. Sharing how to find the complete path to watermelon.db
file. Once with that, we can easily open any SQLite GUI to see data. Sounds good?
@davidsonsns Yes, please do! That would be very helpful to a lot of people to have it right in the docs. Find (or make) the right file in docs-master/ (the docs/ folder is compiled when releasing a new version of 🍉, don't worry about that)
The new database inspector which comes with the Android Studio Beta version is also a very convenient and powerful tool to inspect the Android emulator database Works perfectly with Watermelon
https://medium.com/androiddevelopers/database-inspector-9e91aa265316
For viewing the watermelon db using an iOS simulator on Mac, check out this stackoverflow link which has the following steps:
Once complete, you'll be able to access your tables using the CLI! (btw the brackets {} in step 2 and 3 should not be included when performing your commands, they just indicate placeholders)
Hello friends, I develop with React Native, I almost always need to keep looking at the database during development. to get my file straight from my emulator I use the following command:
adb shell "run-as com.package.name cat /data/data/com.package.name/watermelon.db" > ./your_pc_path_folder/watermelon.db
and later I use another program (DBeaver, Beekeeper) to view the file. I lost some time, but I soon found the above solution. I wouldn't want to get involved with Android Studio's "App Inspector"
@kkkasio What would be the pc path folder? Is that the path to my project?
@kkkasio What would be the pc path folder? Is that the path to my project?
Sorry for the delay, your pc folder must be the directory you want to export the database.
@kkkasio When I try to open the file, it says:
My workaround in RN 0.73.8:
In the android directory:
cd ./android
and run the following command:
run adb shell "run-as com.valnas cat /data/data/com.valnas/ValidationDB.db" > ../database.db
The database name should come from your configuration:
const adapter = new SQLiteAdapter({
dbName: 'ValidationDB',
schema,
migrations,
jsi: true /* Platform.OS === 'ios' */,
onSetUpError: error => {
console.warn(error, 'on SetUp Error');
},
});
Then you will get database.db in the root of the project.
You can open this file in any database viewer, such as DB Browser for SQLite.
I followed the steps mentioned by the @Danu-rxone and I have obtained the .db file.
But when I open the .db file using the browser for sq lite it shows zero tables.
How can I fix the above issue?
This worked for me on windows:
cd ./android
adb shell
run-as com.package.name
cd /data/data/com.package.name/
ls
adb pull /data/data/com.package.name/your-database-name.db.db ./your_pc_path_folder/watermelon.db
Hey guys! Is there a tool which allows to look at tables visually? I'm developing a normal multi table DB and I need to check how do fields populated, removed etc. CLI output is also OK.