Merge branch 'krille/fix-database-transaction' into 'master'
Database transaction workaround See merge request famedly/famedlysdk!352
This commit is contained in:
commit
bb73b4ea2f
|
@ -20,6 +20,18 @@ class Database extends _$Database {
|
||||||
|
|
||||||
int get maxFileSize => 1 * 1024 * 1024;
|
int get maxFileSize => 1 * 1024 * 1024;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<T> transaction<T>(Future<T> Function() action) async {
|
||||||
|
try {
|
||||||
|
await super.transaction(() async {
|
||||||
|
await customSelect('SELECT 1').get();
|
||||||
|
});
|
||||||
|
} catch (_) {
|
||||||
|
return action();
|
||||||
|
}
|
||||||
|
return super.transaction(action);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MigrationStrategy get migration => MigrationStrategy(
|
MigrationStrategy get migration => MigrationStrategy(
|
||||||
onCreate: (Migrator m) {
|
onCreate: (Migrator m) {
|
||||||
|
|
Loading…
Reference in a new issue