Merge pull request #371 from davidmartos96/expose_sqflite_db

Expose the underlying sqflite database object
This commit is contained in:
Simon Binder 2020-02-01 21:34:30 +01:00 committed by GitHub
commit 6e8a9c8d92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,8 @@
## 2.1.0
- Expose the underlying database from sqflite in `FlutterQueryExecutor`.
This exists only to make migrations to moor easier.
## 2.0.0
See the changelog of [moor](https://pub.dev/packages/moor#-changelog-tab-) for details,
or check out an overview of new features [here](https://moor.simonbinder.eu/v2])

View File

@ -188,4 +188,20 @@ class FlutterQueryExecutor extends DelegatedDatabase {
_SqfliteDelegate(true, path,
singleInstance: singleInstance, creator: creator),
logStatements: logStatements);
/// The underlying sqflite [s.Database] object used by moor to send queries.
///
/// Using the sqflite database can cause unexpected behavior in moor. For
/// instance, stream queries won't update for updates sent to the [s.Database]
/// directly.
/// For this reason, projects shouldn't use this getter unless they absolutely
/// need to. The database is exposed to make migrating from sqflite to moor
/// easier.
///
/// Note that this returns null until the moor database has been opened.
/// A moor database is opened lazily when the first query runs.
s.Database get sqfliteDb {
final sqfliteDelegate = delegate as _SqfliteDelegate;
return sqfliteDelegate.db;
}
}

View File

@ -1,6 +1,6 @@
name: moor_flutter
description: Flutter implementation of moor, a safe and reactive persistence library for Dart applications
version: 2.0.0
version: 2.1.0
repository: https://github.com/simolus3/moor
homepage: https://moor.simonbinder.eu/
issue_tracker: https://github.com/simolus3/moor/issues