You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expo-sqlite 57.0.1 (where the crash surfaced), better-sqlite3 11.9.1 (where the error is reproducible on Node)
Describe the Bug
readMigrationFiles splits each migration on --> statement-breakpoint without dropping whitespace-only chunks, and SQLiteSyncDialect.migrate / SQLiteAsyncDialect.migrate (drizzle-orm/src/sqlite-core/dialect.ts) run every chunk through the driver. Two common inputs produce a blank chunk:
a whitespace-only chunk left in a hand-edited file (for example a trailing --> statement-breakpoint), and
the empty placeholder file that drizzle-kit generate --custom writes before you fill it in.
What happens:
better-sqlite3 rejects the chunk with RangeError: The supplied SQL string contains no statements, so the whole migration transaction fails.
expo-sqlite 57.0.1 passes the empty statement to native code and the app dies with EXC_BAD_ACCESS in SQLiteModule.run → sqlite3_clear_bindings (the native side is tracked in [sqlite] Throw for empty SQL statements instead of crashing expo/expo#49066). We hit this variant in a real Expo app: every cold start crashed until the placeholder was filled and Metro's cache cleared.
Expected: whitespace-only chunks are skipped, and a migration with nothing left to run fails with one readable Drizzle error (instead of a driver-specific RangeError or a native crash) and is not recorded as applied, so a forgotten custom placeholder cannot slip past silently.
Reproduction (Node, no Docker): fixture folder with 0000_*.sql ending in --> statement-breakpoint\n, 0001_*.sql containing a single newline, meta/_journal.json with both entries; then migrate(db, { migrationsFolder }) on a better-sqlite3 :memory: database. Fails on main; fix with both cases as regression tests in #6208.
What version of
drizzle-ormare you using?0.45.2
What version of
drizzle-kitare you using?0.31.10
Other packages
expo-sqlite 57.0.1 (where the crash surfaced), better-sqlite3 11.9.1 (where the error is reproducible on Node)
Describe the Bug
readMigrationFilessplits each migration on--> statement-breakpointwithout dropping whitespace-only chunks, andSQLiteSyncDialect.migrate/SQLiteAsyncDialect.migrate(drizzle-orm/src/sqlite-core/dialect.ts) run every chunk through the driver. Two common inputs produce a blank chunk:--> statement-breakpoint), anddrizzle-kit generate --customwrites before you fill it in.What happens:
RangeError: The supplied SQL string contains no statements, so the whole migration transaction fails.EXC_BAD_ACCESSinSQLiteModule.run → sqlite3_clear_bindings(the native side is tracked in [sqlite] Throw for empty SQL statements instead of crashing expo/expo#49066). We hit this variant in a real Expo app: every cold start crashed until the placeholder was filled and Metro's cache cleared.Expected: whitespace-only chunks are skipped, and a migration with nothing left to run fails with one readable Drizzle error (instead of a driver-specific RangeError or a native crash) and is not recorded as applied, so a forgotten custom placeholder cannot slip past silently.
Reproduction (Node, no Docker): fixture folder with
0000_*.sqlending in--> statement-breakpoint\n,0001_*.sqlcontaining a single newline,meta/_journal.jsonwith both entries; thenmigrate(db, { migrationsFolder })on a better-sqlite3:memory:database. Fails onmain; fix with both cases as regression tests in #6208.