Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 23969d9

Browse files
committedOct 8, 2024
Support powersync-sqlite-core 0.3.0.
1 parent aad9ba5 commit 23969d9

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed
 

‎packages/common/src/client/AbstractPowerSyncDatabase.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,13 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
314314
.map((n) => parseInt(n));
315315
} catch (e) {
316316
throw new Error(
317-
`Unsupported powersync extension version. Need ^0.2.0, got: ${this.sdkVersion}. Details: ${e.message}`
317+
`Unsupported powersync extension version. Need >=0.2.0 <0.4.0, got: ${this.sdkVersion}. Details: ${e.message}`
318318
);
319319
}
320320

321-
// Validate ^0.2.0
322-
if (versionInts[0] != 0 || versionInts[1] != 2 || versionInts[2] < 0) {
323-
throw new Error(`Unsupported powersync extension version. Need ^0.2.0, got: ${this.sdkVersion}`);
321+
// Validate >=0.2.0 <0.4.0
322+
if (versionInts[0] != 0 || (versionInts[1] != 2 && versionInts[1] != 3) || versionInts[2] < 0) {
323+
throw new Error(`Unsupported powersync extension version. Need >=0.2.0 <0.4.0, got: ${this.sdkVersion}`);
324324
}
325325
}
326326

‎tools/diagnostics-app/src/app/views/sync-diagnostics.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,21 @@ WITH
2323
(SELECT
2424
bucket,
2525
row_type,
26-
sum(case when op = 3 and superseded = 0 then length(data) else 0 end) as data_size,
27-
sum(length(row_type) + length(row_id) + length(bucket) + length(key) + 40) as metadata_size,
28-
sum(case when op = 3 and superseded = 0 then 1 else 0 end) as row_count
29-
FROM ps_oplog GROUP BY bucket, row_type),
26+
sum(length(ifnull(data, ''))) as data_size,
27+
sum(length(row_type) + length(row_id) + length(key) + 44) as metadata_size,
28+
count() as row_count
29+
FROM ps_oplog
30+
GROUP BY bucket, row_type),
3031
3132
oplog_stats AS
3233
(SELECT
33-
bucket as name,
34+
bucket as bucket_id,
3435
sum(data_size) as data_size,
3536
sum(metadata_size) as metadata_size,
3637
sum(row_count) as row_count,
3738
json_group_array(row_type) tables
38-
FROM oplog_by_table GROUP BY bucket)
39+
FROM oplog_by_table
40+
GROUP BY bucket)
3941
4042
SELECT
4143
local.id as name,
@@ -47,10 +49,11 @@ SELECT
4749
local.total_operations,
4850
local.downloading
4951
FROM local_bucket_data local
50-
LEFT JOIN oplog_stats stats ON stats.name = local.id`;
52+
LEFT JOIN ps_buckets ON ps_buckets.name = local.id
53+
LEFT JOIN oplog_stats stats ON stats.bucket_id = ps_buckets.id`;
5154

5255
const TABLES_QUERY = `
53-
SELECT row_type as name, count() as count, sum(length(data)) as size FROM ps_oplog WHERE superseded = 0 and op = 3 GROUP BY row_type
56+
SELECT row_type as name, count() as count, sum(length(data)) as size FROM ps_oplog GROUP BY row_type
5457
`;
5558

5659
const BUCKETS_QUERY_FAST = `

0 commit comments

Comments
 (0)
Please sign in to comment.