According to the official github page,
OP-SQLite embeds the latest version of SQLite and provides a low-level API to execute SQL queries.
npm
yarn
pnpm
bun
You can use Drizzle Kit for SQL migration generation.
Please make sure to check how Drizzle Kit migrations work before proceeding.
OP SQLite requires you to have SQL migrations bundled into the app and we’ve got you covered.
Install babel plugin
It’s necessary to bundle SQL migration files as string directly to your bundle.
Update config files.
You will need to update babel.config.js, metro.config.js and drizzle.config.ts files
Make sure to have dialect: 'sqlite' and driver: 'expo' in Drizzle Kit config
Generate migrations
After creating SQL schema file and drizzle.config.ts file, you can generate migrations
Add migrations to your app
Now you need to import migrations.js file into your Expo/React Native app from ./drizzle folder.
You can run migrations on application startup using our custom useMigrations migrations hook on in useEffect hook manually as you want.