Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/core/src/view_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ DELETE FROM ps_buckets;
DELETE FROM ps_untyped;
DELETE FROM ps_updated_rows;
DELETE FROM ps_kv WHERE key != 'client_id';
DELETE FROM ps_sync_state;
",
)?;

Expand Down
15 changes: 15 additions & 0 deletions dart/test/sync_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,21 @@ void main() {
isNotEmpty);
}
});

test('clearing database clears sync status', () {
pushSyncData('prio1', '1', 'row-0', 'PUT', {'col': 'hi'});

expect(
pushCheckpointComplete(
'1', null, [_bucketChecksum('prio1', 1, checksum: 0)]),
isTrue);
expect(db.select('SELECT powersync_last_synced_at() AS r').single,
{'r': isNotNull});

db.execute('SELECT powersync_clear(0)');
expect(db.select('SELECT powersync_last_synced_at() AS r').single,
{'r': isNull});
});
});
}

Expand Down