mirror of https://github.com/AMT-Cheif/drift.git
Upgrade to latest `sqlite3` package in example app
This commit is contained in:
parent
c5183deea6
commit
9e2e9c47be
|
@ -18,20 +18,19 @@ DatabaseConnection connect({bool isInWebWorker = false}) {
|
|||
return remote(worker.port!.channel());
|
||||
} else {
|
||||
return DatabaseConnection.delayed(Future.sync(() async {
|
||||
// We're using the experimental wasm support in Drift because this gives us
|
||||
// a recent sqlite3 version with fts5 support.
|
||||
// We're using the experimental wasm support in Drift because this gives
|
||||
// us a recent sqlite3 version with fts5 support.
|
||||
// This is still experimental, so consider using the approach described in
|
||||
// https://drift.simonbinder.eu/web/ instead.
|
||||
|
||||
final response = await http.get(Uri.parse('sqlite3.wasm'));
|
||||
final fs = await IndexedDbFileSystem.load('/drift/my_app/');
|
||||
final fs = await IndexedDbFileSystem.open(dbName: 'my_app');
|
||||
final sqlite3 = await WasmSqlite3.load(
|
||||
response.bodyBytes,
|
||||
SqliteEnvironment(fileSystem: fs),
|
||||
);
|
||||
|
||||
final databaseImpl =
|
||||
WasmDatabase(sqlite3: sqlite3, path: '/drift/my_app/app.db');
|
||||
final databaseImpl = WasmDatabase(sqlite3: sqlite3, path: 'app.db');
|
||||
return DatabaseConnection.fromExecutor(databaseImpl);
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -202,8 +202,6 @@ class $CategoriesTable extends Categories
|
|||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => {id};
|
||||
@override
|
||||
List<Set<GeneratedColumn>> get uniqueKeys => [];
|
||||
@override
|
||||
Category map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
return Category.fromData(data,
|
||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
||||
|
@ -463,8 +461,6 @@ class $TodoEntriesTable extends TodoEntries
|
|||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => {id};
|
||||
@override
|
||||
List<Set<GeneratedColumn>> get uniqueKeys => [];
|
||||
@override
|
||||
TodoEntry map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
return TodoEntry.fromData(data,
|
||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
||||
|
@ -613,8 +609,6 @@ class TextEntries extends Table
|
|||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
||||
@override
|
||||
List<Set<GeneratedColumn>> get uniqueKeys => [];
|
||||
@override
|
||||
TextEntrie map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
return TextEntrie.fromData(data,
|
||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
||||
|
|
|
@ -17,7 +17,7 @@ dependencies:
|
|||
intl: ^0.17.0
|
||||
http: ^0.13.4 # used to load sqlite3 wasm files on the web
|
||||
sqlite3_flutter_libs: ^0.5.5
|
||||
sqlite3: ^1.6.1
|
||||
sqlite3: ^1.7.0
|
||||
path_provider: ^2.0.9
|
||||
path: ^1.8.0
|
||||
riverpod: ^1.0.3
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue