op-sqlite
op-sqlite copied to clipboard
drizzle studio support
What happened?
I tried to run drizzle-kit studio
But got this error
Invalid input Please specify a 'dbCredentials' param in config. It will help drizzle to know how to query you database. You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference
Not sure what to add to dbCredentials since the db is in the device
And then i saw https://github.com/drizzle-team/drizzle-studio-expo this plugin in the expo-sqlite doc.
When i tried that for op-sqlite
it throws
ERROR [TypeError: db.prepareAsync is not a function (it is undefined)]
Is op-sqlite doesn't have the ability to run in drizzle studio right now? or there is an equivalent for expo something similar to drizzle-studio-expo?
op-sqlite version
14.0.1
React Native version
0.79.2
Reproducible Example
will update if needed
I don't know how drizzle or their studio works, I guess expo added custom native code to make that integration possible, which op-sqlite does not have. So no, drizzle studio is not supported. PRs are welcome or maybe some integration guide.
I guess it doesn’t have to be Drizzle Studio. A minimal UI with the ability to show query data (GET) and perform mutations (ADD, UPDATE, DELETE) would do the job. This way, users who don’t use Drizzle can still use it, since it’s decoupled from Drizzle.
There’s an integration guide on how to create an Expo DevTools plugin here: https://docs.expo.dev/debugging/create-devtools-plugins/
Maybe we can create an npm package called op-sqlite-devtools.
We could then use it in the app like this:
import { open } from '@op-engineering/op-sqlite'
import { useOpSQLiteDevTools } from 'op-sqlite-devtools'
const db = open({
name: 'myDB',
})
export default function App() {
useOpSQLiteDevTools(db)
return <>the rest of the code</>
}
I tried looking at the integration guide, but I’m still not entirely sure how the data is sent and received by the web UI. Would you mind taking a look at the guide?
I don't like tools that run only on expo. I guess you are better off asking on the drizzle repo/discord what do they need to enable their studio. As for a custom built tool, I don't think I will do this for free, but PRs are welcome.
I made the drizzle studio support yall, and it's stable
https://github.com/AmeerArsala/expo-opsqlite-drizzle-studio-plugin
^ it's on npm as well
Going to close this since @AmeerArsala made a working plugin