Skip to content

Commit cf0cbdc

Browse files
committed
Use json_extract to be compatible with sqlite before 3.38 and add a where clause to filter events
1 parent 17bfac8 commit cf0cbdc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mithril-aggregator/src/event_store/database/migration.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ create index metric_date_index on event(date(json_extract(content, '$.content.da
3939
create view stake_signer_version as with
4040
signer_version as (
4141
select
42-
content->>'$.content.party_id' as party_id,
43-
content->>'$.headers.signer-node-version' as node_version,
44-
content->>'$.headers.epoch' as epoch,
45-
content->>'$.content.stake' as stakes
42+
json_extract(content, '$.content.party_id') as party_id,
43+
json_extract(content, '$.headers.signer-node-version') as node_version,
44+
json_extract(content, '$.headers.epoch') as epoch,
45+
json_extract(content, '$.content.stake') as stakes
4646
from event
47+
where action='register_signer'
4748
order by created_at desc
4849
),
4950
stakes_version as (

0 commit comments

Comments
 (0)