fix(#363): keep sqlite3 (dart:ffi) out of the web build
The VACUUM INTO snapshot import pulled dart:ffi via package:sqlite3, which does not compile on web. Isolate it behind a conditional import (native impl + web stub); the migration is native-only and never runs on web. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>chore/365-cut-1.2.1
parent
e45946a3d3
commit
b1fb227b4c
@ -0,0 +1,13 @@
|
||||
import 'package:sqlite3/sqlite3.dart';
|
||||
|
||||
/// Snapshots [source] to [target] with SQLite `VACUUM INTO` (a consistent,
|
||||
/// transaction-based copy). Native only; isolated in its own file so the
|
||||
/// `dart:ffi`-backed sqlite3 import never reaches the web build (#363).
|
||||
void vacuumInto(String source, String target) {
|
||||
final db = sqlite3.open(source, mode: OpenMode.readOnly);
|
||||
try {
|
||||
db.execute("VACUUM INTO '${target.replaceAll("'", "''")}'");
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
/// Web stub for [vacuumInto]. The pinned-directory migration is native-only
|
||||
/// (web uses drift's OPFS/IndexedDB backend and never calls this), so this
|
||||
/// exists only to keep the conditional import from pulling `dart:ffi` into the
|
||||
/// web build (#363).
|
||||
void vacuumInto(String source, String target) =>
|
||||
throw UnsupportedError('vacuumInto is native-only');
|
||||
Loading…
Reference in new issue