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