Expo app + drizzle-kit migrations and enabling journal_mode = WAL

Hey, I'm pretty new to SQLite and drizzle-kit. I've read that enabling WAL journal mode on your SQLite DB is preferred for performance. I thought it made sense to create a custom migration npx drizzle-kit generate --custom with this statement in it: PRAGMA journal_mode = WAL; but when I deploy to my device (Android phone) the migration fails to run. Is this not the way I should be doing it?
1 Reply
Chris Dosé
Chris DoséOP2mo ago
I'm doing it like this now, is this ok to do?
import { drizzle } from "drizzle-orm/expo-sqlite";
import { openDatabaseSync } from "expo-sqlite";

import * as schema from "./schema";

export const expoDb = openDatabaseSync("ambry.db", {
enableChangeListener: true,
});
expoDb.execSync("PRAGMA journal_mode = WAL;");
export const db = drizzle(expoDb, { schema });
import { drizzle } from "drizzle-orm/expo-sqlite";
import { openDatabaseSync } from "expo-sqlite";

import * as schema from "./schema";

export const expoDb = openDatabaseSync("ambry.db", {
enableChangeListener: true,
});
expoDb.execSync("PRAGMA journal_mode = WAL;");
export const db = drizzle(expoDb, { schema });
Want results from more Discord servers?
Add your server