skip to Main Content

I am having hard times visualizing my sqlite database , i am using react native under expo with drizzle ORM to manage a sqlite database locally , the issues is that when i run all the setup commands it says that the tables of the schema are created successfully but when i try to visualize the database i can not find the .sqlite file to open it in sqlite studio or something , idk if it is an issue with my code or is it just that drizzle issue?

code : drizzle.config.ts

import type { Config } from 'drizzle-kit';
export default {
schema: './db/schema.ts',
out: './drizzle',
dialect: 'sqlite',
driver: 'expo',

} satisfies Config;

2

Answers


  1. Chosen as BEST ANSWER

    Yes using drizzle studio solved the issue but i recommend using it only in dev mode , if you build your app with it the app crashes in production .


  2. The problem is that the sqlite file is inside the iOS/Android Simulator not in your project.

    You can use expo-drizzle-studio-plugin to view the database.

    import { useDrizzleStudio } from "expo-drizzle-studio-plugin";
    import * as SQLite from "expo-sqlite";
    import { View } from "react-native";
    
    const db = SQLite.openDatabaseSync("db");
    
    export default function App() {
        useDrizzleStudio(db);
    
        return <View></View>;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search