Skip to content

Commit df61b6f

Browse files
committed
powersync_in_sync_operation guard in all triggers
1 parent bcb4b98 commit df61b6f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

demos/supabase-todolist/lib/raw_tables_helper.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Future<void> _createUpdateListTrigger(SqliteWriteContext ctx) async {
112112
CREATE TRIGGER ${table}_update
113113
AFTER UPDATE ON $table
114114
FOR EACH ROW
115+
WHEN NOT powersync_in_sync_operation()
115116
BEGIN
116117
SELECT CASE
117118
WHEN (OLD.id != NEW.id)
@@ -131,6 +132,7 @@ Future<void> _createDeleteListTrigger(SqliteWriteContext ctx) async {
131132
CREATE TRIGGER ${table}_delete
132133
AFTER DELETE ON $table
133134
FOR EACH ROW
135+
WHEN NOT powersync_in_sync_operation()
134136
BEGIN
135137
INSERT INTO powersync_crud_(data) VALUES(json_object('op', 'DELETE', 'type', '$table', 'id', OLD.id));
136138
INSERT OR IGNORE INTO ps_updated_rows(row_type, row_id) VALUES('$table', OLD.id);

0 commit comments

Comments
 (0)