React Native Expo SQLite: DrizzleError: Failed to run the query

Hellow everyone! Im trying to make drizzle work in react native (https://orm.drizzle.team/docs/get-started-sqlite#expo-sqlite) and right now Im getting the following error when I use useMigrations hook in my app entry:
Possible Unhandled Promise Rejection (id: 0):
DrizzleError: Failed to run the query '
CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
'
DrizzleError: Failed to run the query '
CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
'
Possible Unhandled Promise Rejection (id: 0):
DrizzleError: Failed to run the query '
CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
'
DrizzleError: Failed to run the query '
CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
'
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
8 Replies
Angelelz
Angelelz15mo ago
It seems like in the app, there is no access to the sqlite database Maybe?
smashboy
smashboyOP15mo ago
I dont think so. Just tried using expo sqlite without drizzle and looks like it is working
Angelelz
Angelelz15mo ago
Isn't this how you are supposed to connect to your db?
import { drizzle } from "drizzle-orm/expo-sqlite";
import { openDatabaseSync } from "expo-sqlite/next";
const expo = openDatabaseSync("db.db");
const db = drizzle(expo);
await db.select().from(users);
import { drizzle } from "drizzle-orm/expo-sqlite";
import { openDatabaseSync } from "expo-sqlite/next";
const expo = openDatabaseSync("db.db");
const db = drizzle(expo);
await db.select().from(users);
smashboy
smashboyOP15mo ago
I think docs are outdated, because I dont have import { openDatabaseSync } from "expo-sqlite/next"; in my expo-sqlite version "expo-sqlite": "~11.3.3",
Angelelz
Angelelz15mo ago
I haven't use this module just yet, what do you think @Andrew Sherman ?
Andrii Sherman
Andrii Sherman15mo ago
cc @alexblokh
alexblokh
alexblokh15mo ago
@smashboy
No description
No description
smashboy
smashboyOP15mo ago
Strange, npx expo install ignores @next. Thanks! Will try to figure out how to update it then

Did you find this page helpful?