-
Notifications
You must be signed in to change notification settings - Fork 29
Drift Example #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drift Example #60
Conversation
You can make drift work with concurrency via WAL mode: Native...
return NativeDatabase.createInBackground(
file,
logStatements: logStatements,
cachePreparedStatements: true,
setup: (db) {
db.execute('PRAGMA journal_mode=WAL');
db.execute('PRAGMA busy_timeout=100');
},
);
... Web (WASM)...
final result = await WasmDatabase.open(
databaseName: dbName.replaceAll('.db', ''),
sqlite3Uri: sqliteUrl,
driftWorkerUri: Uri.parse('/drift_worker.js'),
initializeDatabase: preload,
localSetup: (db) {
db.execute('PRAGMA journal_mode=WAL');
db.execute('PRAGMA busy_timeout=100');
},
);
... |
In this case the database is managed by sqlite_async, which already uses WAL mode. The problem is with write we interact with Drift, we need write locks even for select statements (implicit in Also FWIW, no current VFS supports |
Now published as https://github.com/powersync-ja/drift_sqlite_async |
Is this feature abandoned? |
While it may lack some features, we haven't had any significant issue reports for it yet, which is why there hasn't been any updates since. Right now we're focusing on getting web support stable. Once that is out, we'll work on getting this package better integrated and part of our standard examples. |
Closing in favor of #134. |
POC of using Drift as an ORM for the supabase-todolist demo.
The bulk of the integration is in thedrift_sqlite_async.dart
file, loosely based on the drift_sqflite query executor. The implementation applies to sqlite_async in general - nothing is directly coupled to PowerSync.Update: Uses the new drift_sqlite_async package.
Tested and working: