-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
I have this code:
Future<Stream<ResultSet>> watch(
String query,
Map<String, Object?> parameters, [
List<String>? triggerOnTables,
]) async {
final db = await _getDb();
final (q, p) = _convertQuery(query, parameters);
return db.database.watch(
q,
parameters: p,
triggerOnTables: triggerOnTables,
);
}
I'm calling it with:
watch(
"SELECT * FROM users WHERE id = @id LIMIT 1;",
{"id": 1},
["users", "user_settings"],
);
(don't worry about the @id
, consider it is a valid SQLite query)
The watch is made by sqlite_async, on this line: https://github.com/powersync-ja/sqlite_async.dart/blob/26315e1e5c8e9b7ea25c70db93e0cfe5604bf888/lib/src/update_notification.dart#L62
Problem is: power sync changes the names of the tables and give us views emulating our schema, so this watch fails, because user
and user_settings
should be ps_data__user
and ps_data__user_settings
.
I know it is not really ps fault, but this should be handled somehow... maybe encapsulating sqlite_async and providing the same interface, with some safeguards (such as correcting those table names)?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request