mirror of https://github.com/AMT-Cheif/drift.git
remove leading slashes from URI paths
This commit is contained in:
parent
3e50d70460
commit
4e28e5f5b9
|
@ -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) {
|
||||
|
|
|
@ -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,18 +82,18 @@ 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)
|
||||
.insert(TestTableCompanion.insert(content: 'from old database'));
|
||||
await db.close();
|
||||
|
||||
final (file: file, outFlags: _) = fs.xOpen(Sqlite3Filename('/app.db'), 0);
|
||||
final (file: file, outFlags: _) = fs.xOpen(Sqlite3Filename('app.db'), 0);
|
||||
final blob = Uint8List(file.xFileSize());
|
||||
file.xRead(blob, 0);
|
||||
file.xClose();
|
||||
|
|
Loading…
Reference in New Issue