Error with Expo Sqlite + Drizzle

So i try to use Drizzle with expo everything are set but i got an error
[Error: undefined Unable to resolve module ./0000_crazy_prodigy.sql from /Users/x/todo-expo-drizzle/drizzle/migrations.js:

None of these files exist:
* drizzle/0000_crazy_prodigy.sql(.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.mjs|.native.mjs|.mjs|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json|.ios.cjs|.native.cjs|.cjs|.ios.scss|.native.scss|.scss|.ios.sass|.native.sass|.sass|.ios.css|.native.css|.css)
* drizzle/0000_crazy_prodigy.sql
2 |
3 | import journal from './meta/_journal.json';
> 4 | import m0000 from './0000_crazy_prodigy.sql';
| ^
5 |
6 | export default {
7 | journal,]
[Error: undefined Unable to resolve module ./0000_crazy_prodigy.sql from /Users/x/todo-expo-drizzle/drizzle/migrations.js:

None of these files exist:
* drizzle/0000_crazy_prodigy.sql(.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.mjs|.native.mjs|.mjs|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json|.ios.cjs|.native.cjs|.cjs|.ios.scss|.native.scss|.scss|.ios.sass|.native.sass|.sass|.ios.css|.native.css|.css)
* drizzle/0000_crazy_prodigy.sql
2 |
3 | import journal from './meta/_journal.json';
> 4 | import m0000 from './0000_crazy_prodigy.sql';
| ^
5 |
6 | export default {
7 | journal,]
Any idea what the error with this? not sure i follow everything but still getting this error
11 Replies
ericson
ericsonOP8mo ago
ops looks like i need to add the metro config and babel but still having experience an error
SyntaxError: .../drizzle/0000_crazy_prodigy.sql: Missing semicolon. (1:6)

> 1 | CREATE TABLE `plan` (
| ^
2 | `id` text PRIMARY KEY NOT NULL,
3 | `type` text NOT NULL,
4 | `title` text NOT NULL,
SyntaxError: .../drizzle/0000_crazy_prodigy.sql: Missing semicolon. (1:6)

> 1 | CREATE TABLE `plan` (
| ^
2 | `id` text PRIMARY KEY NOT NULL,
3 | `type` text NOT NULL,
4 | `title` text NOT NULL,
Query:
CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
(NOBRIDGE) LOG Query: SELECT id, hash, created_at FROM "__drizzle_migrations" ORDER BY created_at DESC LIMIT 1
(NOBRIDGE) LOG Query: BEGIN
(NOBRIDGE) LOG Query: ROLLBACK
Query:
CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
(NOBRIDGE) LOG Query: SELECT id, hash, created_at FROM "__drizzle_migrations" ORDER BY created_at DESC LIMIT 1
(NOBRIDGE) LOG Query: BEGIN
(NOBRIDGE) LOG Query: ROLLBACK
based on logger now i got this error
Failed to run the query 'CREATE TABLE `plan` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`type` text NOT NULL,
`title` text NOT NULL,
`description` text,
`category` text DEFAULT 'general' NOT NULL,
`icon` text,
`estimated_pomodoro` integer DEFAULT 1,
`completed_pomodoro` integer DEFAULT 0,
`priority` text DEFAULT 'normal',
`recurrence` text,
`deadline` text,
`created_at` text DEFAULT strftime('%Y-%m-%dT%H:%M:%fZ', 'now') NOT NULL,
`updated_at` text
);
'
Failed to run the query 'CREATE TABLE `plan` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`type` text NOT NULL,
`title` text NOT NULL,
`description` text,
`category` text DEFAULT 'general' NOT NULL,
`icon` text,
`estimated_pomodoro` integer DEFAULT 1,
`completed_pomodoro` integer DEFAULT 0,
`priority` text DEFAULT 'normal',
`recurrence` text,
`deadline` text,
`created_at` text DEFAULT strftime('%Y-%m-%dT%H:%M:%fZ', 'now') NOT NULL,
`updated_at` text
);
'
Any idea?
cihad
cihad3mo ago
Hi i am facing the same issue currently. Were you able to fix this? If so what was your solution for this?
ericson
ericsonOP3mo ago
Ohhh yes i did fresh setup from drizzle orm + expo-sqlite
cihad
cihad3mo ago
But what did you do any different to be able to fix this?
snoob
snoob3mo ago
were you able to figure this out cihad? Im having the same error. Tried clearing everything, rebuilding, I have the babel plugin installed, metro config set up, babel config set up, tried npx expo start -c. STILL not working and im going mad any intel you can give me would be greatly appreciated 🙏
cihad
cihad3mo ago
@snoob yeah kind of. to be able to debug it a bit better i put my drizzle querys into a try catch and logged the error in the catch block, this helped a lot to identify the actual problem.. maybe also log the error state of your migration.. in my case there was something wrong with the schema itself if i don't remember it wrong
cihad
cihad3mo ago
i just checked the fix commit, i also did some changes to the metro config file. in some tutorials and docs it's stated as assetExts, but using sourceExts might also have fixed it 🤔
No description
cihad
cihad3mo ago
if you want i can share the repo with you, it's public. its by far not a good reference project but it might help you to compare with yours
snoob
snoob3mo ago
ohhhh I see okay, so it could just throw some generic error. Thats so funny, claude code made that change, and I was like wow thats random, and undid that sourceExts change. let me try that lol oh gosh please send it
cihad
cihad3mo ago
i don't know if i am violating any rules by sharing here, but here you go: https://github.com/cihadaydemir/prorgress-tracker like i said it's not very clean 😄 it's actualy my first expo project ever so i am also still figuring out. but at least got sqlite + drizzle working for now
GitHub
GitHub - cihadaydemir/prorgress-tracker
Contribute to cihadaydemir/prorgress-tracker development by creating an account on GitHub.
cihad
cihad3mo ago
Lol, okay great 😄 I just checked the official drizzle docs. They actually use sourceExts, but I guess use what ever works 🤷‍♂️😂 I also don't know the difference, I might change it aswell, if it causes errors in future.

Did you find this page helpful?