After installing the template and adding the db folder, you’ll find the following content: In the db/schema.ts file with drizzle table definitions. The drizzle folder contains SQL migration files and snapshots
Step 2 - Install expo-sqlite package
npm
yarn
pnpm
bun
Step 3 - Install required packages
npm
yarn
pnpm
bun
Step 4 - Connect Drizzle ORM to the database
Create a App.tsx file in the root directory and initialize the connection:
Step 4 - Create a table
Create a schema.ts file in the db directory and declare your table:
Step 5 - Setup Drizzle config file
Drizzle config - a configuration file that is used by Drizzle Kit and contains all the information about your database connection, migration folder and schema files.
Create a drizzle.config.ts file in the root of your project and add the following content:
Step 6 - Setup metro config
Create a file metro.config.js in root folder and add this code inside:
Step 7 - Update babel config
Step 8 - Applying changes to the database
With Expo, you would need to generate migrations using the drizzle-kit generate command and then apply them at runtime using the drizzle-ormmigrate() function
Generate migrations:
Step 9 - Apply migrations and query your db:
Let’s App.tsx file with migrations and queries to create, read, update, and delete users