simolus3 / drift

Drift is an easy to use, reactive, typesafe persistence library for Dart & Flutter.
https://drift.simonbinder.eu/
MIT License
2.43k stars 351 forks source link

`enableMigrations` param for web implementation. #2992

Closed davidmartos96 closed 1 month ago

davidmartos96 commented 1 month ago

Would it be possible to use the same enableMigrations configuration in a Web setup like this one?

DatabaseConnection connect() {
  return DatabaseConnection.delayed(Future(() async {
    final db = await WasmDatabase.open(
      databaseName: webDbName,
      sqlite3Uri: _sqlite3Uri,
      driftWorkerUri: _driftWorkerUri,
    );

    final conn = db.resolvedExecutor;
    return conn;
  }));
}
simolus3 commented 1 month ago

Good call, I was just to lazy to implement it right away because it requires changes to the protocol between the worker and the main tab. Fixed in f2299152feb29d708cc5a12d86265fb941f067be (but you'll also have to update your drift worker once that is released).