chore: Move the drift_offline_first to legacy in favor of Serverpod implementation (#32)

This commit is contained in:
Marcelo Mendonça Soares 2026-04-05 23:20:21 -03:00 • committed by Marcelo Soares
commit cbc472523b
No known key found for this signature in database
GPG key ID: CB2F09CE66E99EAD

View file

@ -0,0 +1,13 @@
import 'package:drift/drift.dart';
import 'package:drift_offline_sync/drift_offline_sync.dart';
/// Extensions for [GeneratedDatabase] to get the CRDT context for testing.
extension CrdtContextExtensions on GeneratedDatabase {
(OfflineSyncCrdt crdt, CrdtDatabase crdtDb, String nodeId) get crdtContext {
final migrator = createMigrator();
if (migrator is! OfflineSyncMigrator) {
throw StateError('Migrator is not an OfflineSyncMigrator');
}
return (migrator.crdt, migrator.crdtDb, migrator.nodeId);
}
}