Skip to content

Commit 72ab30d

Browse files
committed
Clear sync completions in powersync_clear
1 parent f13a5f1 commit 72ab30d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

crates/core/src/view_admin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ DELETE FROM ps_buckets;
162162
DELETE FROM ps_untyped;
163163
DELETE FROM ps_updated_rows;
164164
DELETE FROM ps_kv WHERE key != 'client_id';
165+
DELETE FROM ps_sync_state;
165166
",
166167
)?;
167168

dart/test/sync_test.dart

+15
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,21 @@ void main() {
182182
isNotEmpty);
183183
}
184184
});
185+
186+
test('clearing database clears sync status', () {
187+
pushSyncData('prio1', '1', 'row-0', 'PUT', {'col': 'hi'});
188+
189+
expect(
190+
pushCheckpointComplete(
191+
'1', null, [_bucketChecksum('prio1', 1, checksum: 0)]),
192+
isTrue);
193+
expect(db.select('SELECT powersync_last_synced_at() AS r').single,
194+
{'r': isNotNull});
195+
196+
db.execute('SELECT powersync_clear(0)');
197+
expect(db.select('SELECT powersync_last_synced_at() AS r').single,
198+
{'r': isNull});
199+
});
185200
});
186201
}
187202

0 commit comments

Comments
 (0)