Sqlite syntax error when calling useMigrations in react-native expo app

Hello, I'm currently trying to set up a React Native app and having some problems with useMigrations. The error is complaining about the syntax but it looks fine to me:
error: SyntaxError: /root/coding/kutuba-app/drizzle/0000_stale_natasha_romanoff.sql: Missing semicolon. (1:6)

> 1 | CREATE TABLE `LESSONS` (
| ^
2 | `ID` integer PRIMARY KEY NOT NULL,
3 | `LESSON_NUM` integer,
4 | `TITLE` text,
error: SyntaxError: /root/coding/kutuba-app/drizzle/0000_stale_natasha_romanoff.sql: Missing semicolon. (1:6)

> 1 | CREATE TABLE `LESSONS` (
| ^
2 | `ID` integer PRIMARY KEY NOT NULL,
3 | `LESSON_NUM` integer,
4 | `TITLE` text,
The full SQL is here: https://github.com/plutoniumcat/kutuba-app/blob/drizzle-problem/drizzle/0000_stale_natasha_romanoff.sql Here's the part of my code that calls useMigrations: https://github.com/plutoniumcat/kutuba-app/blob/drizzle-problem/src/database/DatabaseInitialization.ts I've looked through the discord for similar issues, and added breakpoints: true to drizzle.config, but unfortunately that didn't help. (I also tried it with breakpoints: false just to check and got the same error). Any suggestions on what to try next?
2 Replies
autumnstwilight
autumnstwilight5mo ago
Update: Managed to solve this. I've been moving things over from another repo and forgot to install babel-plugin-inline-import and update babel.config in the new repo. Okay, actually it's not fixed. After I did the above steps, I got a new error "Migration error: cannot read property 'dialect' of undefined", implying that it wasn't importing the journal properly. So after some experimentation I went into migrations.js and changed the import/export to the following:
const journal = require('./meta/_journal.json');
const m0000 = require('./0000_mixed_chat.sql');

module.exports = {
journal,
migrations: {
m0000
}
}
const journal = require('./meta/_journal.json');
const m0000 = require('./0000_mixed_chat.sql');

module.exports = {
journal,
migrations: {
m0000
}
}
Now it seems to find the journal okay, but I'm back to the original SQL syntax error... I still haven't resolved this. I have repeated all the steps for setting up drizzle with expo-sqlite from the documentation in case I missed anything and experimented with Typescript compiler and babel plugins. I regenerated the migrations (so the import statements are back how they originally were) and currently I have the "Migration error: cannot read property 'dialect' of undefined" error occurring.
Alekzv9
Alekzv92mo ago
Any luck? I'm still stuck in creating tables with the migration What I'm doing now is executing the "migrations" (sql string) with expo sqlite methods
Want results from more Discord servers?
Add your server