mirror of https://github.com/AMT-Cheif/drift.git
Merge branch 'elitree/develop' into develop
This commit is contained in:
commit
6408d93a7c
|
@ -86,8 +86,8 @@ class Database extends _$Database {
|
|||
Future<WasmDatabaseResult> connect() async {
|
||||
final result = await WasmDatabase.open(
|
||||
databaseName: 'todo_example',
|
||||
sqlite3Uri: Uri.parse('/sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('/drift_worker.dart.js'),
|
||||
sqlite3Uri: Uri.parse('sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('drift_worker.dart.js'),
|
||||
);
|
||||
|
||||
if (!result.chosenImplementation.fullySupported) {
|
||||
|
|
|
@ -10,8 +10,8 @@ DatabaseConnection connectOnWeb() {
|
|||
return DatabaseConnection.delayed(Future(() async {
|
||||
final result = await WasmDatabase.open(
|
||||
databaseName: 'my_app_db', // prefer to only use valid identifiers here
|
||||
sqlite3Uri: Uri.parse('/sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('/drift_worker.dart.js'),
|
||||
sqlite3Uri: Uri.parse('sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('drift_worker.dart.js'),
|
||||
);
|
||||
|
||||
if (result.missingFeatures.isNotEmpty) {
|
||||
|
@ -64,8 +64,8 @@ DatabaseConnection migrateAndConnect() {
|
|||
// Then you can migrate like this
|
||||
final result = await WasmDatabase.open(
|
||||
databaseName: 'my_app',
|
||||
sqlite3Uri: Uri.parse('/sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('/drift_worker.dart.js'),
|
||||
sqlite3Uri: Uri.parse('sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('drift_worker.dart.js'),
|
||||
initializeDatabase: () async {
|
||||
// Manually open the file system previously used
|
||||
final fs = await IndexedDbFileSystem.open(dbName: 'my_app');
|
||||
|
@ -101,8 +101,8 @@ DatabaseConnection migrateFromLegacy() {
|
|||
// #docregion migrate-legacy
|
||||
final result = await WasmDatabase.open(
|
||||
databaseName: 'my_app',
|
||||
sqlite3Uri: Uri.parse('/sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('/drift_worker.dart.js'),
|
||||
sqlite3Uri: Uri.parse('sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('drift_worker.dart.js'),
|
||||
initializeDatabase: () async {
|
||||
final storage = await DriftWebStorage.indexedDbIfSupported('old_db');
|
||||
await storage.open();
|
||||
|
|
|
@ -18,8 +18,8 @@ void main() async {
|
|||
try {
|
||||
final db = await WasmDatabase.open(
|
||||
databaseName: 'test_db',
|
||||
sqlite3Uri: Uri.parse('/sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('/drift_worker.dart.js'),
|
||||
sqlite3Uri: Uri.parse('sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('drift_worker.dart.js'),
|
||||
);
|
||||
|
||||
results.innerText += '''
|
||||
|
|
|
@ -9,8 +9,8 @@ DatabaseConnection connect() {
|
|||
return DatabaseConnection.delayed(Future(() async {
|
||||
final db = await WasmDatabase.open(
|
||||
databaseName: 'todo-app',
|
||||
sqlite3Uri: Uri.parse('/sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('/drift_worker.js'),
|
||||
sqlite3Uri: Uri.parse('sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('drift_worker.js'),
|
||||
);
|
||||
|
||||
if (db.missingFeatures.isNotEmpty) {
|
||||
|
|
|
@ -3,5 +3,5 @@ Integration tests for `package:drift/native.dart`.
|
|||
To run the tests automatically (with us managing a browser driver), just run `dart test`.
|
||||
|
||||
To manually debug issues, it might make sense to trigger some functionality manually.
|
||||
You can run `dart run tool/server_manually.dart` to start a web server hosting the test
|
||||
content on http://localhost:8080.
|
||||
You can run `dart run tool/serve_manually.dart` to start a web server hosting the test
|
||||
content on <http://localhost:8080>.
|
||||
|
|
|
@ -11,8 +11,8 @@ import 'package:web_wasm/src/database.dart';
|
|||
import 'package:sqlite3/wasm.dart';
|
||||
|
||||
const dbName = 'drift_test';
|
||||
final sqlite3WasmUri = Uri.parse('/sqlite3.wasm');
|
||||
final driftWorkerUri = Uri.parse('/worker.dart.js');
|
||||
final sqlite3WasmUri = Uri.parse('sqlite3.wasm');
|
||||
final driftWorkerUri = Uri.parse('worker.dart.js');
|
||||
|
||||
TestDatabase? openedDatabase;
|
||||
StreamQueue<void>? tableUpdates;
|
||||
|
@ -82,11 +82,11 @@ Future<Uint8List?> _initializeDatabase() async {
|
|||
|
||||
// Let's first open a custom WasmDatabase, the way it would have been
|
||||
// done before WasmDatabase.open.
|
||||
final sqlite3 = await WasmSqlite3.loadFromUrl(Uri.parse('/sqlite3.wasm'));
|
||||
final sqlite3 = await WasmSqlite3.loadFromUrl(Uri.parse('sqlite3.wasm'));
|
||||
final fs = await IndexedDbFileSystem.open(dbName: dbName);
|
||||
sqlite3.registerVirtualFileSystem(fs, makeDefault: true);
|
||||
|
||||
final wasmDb = WasmDatabase(sqlite3: sqlite3, path: '/app.db');
|
||||
final wasmDb = WasmDatabase(sqlite3: sqlite3, path: 'app.db');
|
||||
final db = TestDatabase(wasmDb);
|
||||
await db
|
||||
.into(db.testTable)
|
||||
|
|
Loading…
Reference in New Issue