-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschema.bash
More file actions
52 lines (48 loc) · 1.6 KB
/
schema.bash
File metadata and controls
52 lines (48 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
PG_URL="postgres://postgres:@rpc.dev-01.bas.ankr.com:7432/blockscout?sslmode=disable"
#mkdir -p shared/entity
#xo schema "$PG_URL" -o ./shared/entity
#xo query "$PG_URL" --append --trim --strip -o shared/entity -T Block <<ENDSQL
#SELECT * FROM "blocks"
#ORDER BY "timestamp" DESC
#LIMIT %%limit uint64%%
#ENDSQL
#
#xo query "$PG_URL" --append --trim --strip -o shared/entity -T Block <<ENDSQL
#SELECT * FROM "blocks"
#WHERE %%number uint64%% >= number
#ORDER BY "timestamp" DESC
#LIMIT %%limit uint64%%
#ENDSQL
#
#xo query "$PG_URL" --append --trim --strip -o shared/entity -T Transaction <<ENDSQL
#SELECT * FROM "transactions"
#ORDER BY "updated_at" DESC
#LIMIT %%limit uint64%%
#ENDSQL
#
#xo query "$PG_URL" --append --trim --strip -o shared/entity -T Transaction <<ENDSQL
#SELECT * FROM "transactions"
#WHERE %%ts string%% <= updated_at
#ORDER BY "updated_at" DESC
#LIMIT %%limit uint64%%
#ENDSQL
#
#xo query "$PG_URL" --append --trim --strip -o shared/entity -T AddressTokenBalance <<ENDSQL
#SELECT * FROM "address_token_balances"
#WHERE address_hash = %%hash []byte%%
#ENDSQL
#
#xo query "$PG_URL" --append --trim --strip -o shared/entity -T TokenTransfer <<ENDSQL
#SELECT * FROM "token_transfers"
#WHERE transaction_hash = %%hash []byte%%
#ENDSQL
#
#xo query "$PG_URL" --append --trim --strip -o shared/entity -T ContractMethod <<ENDSQL
#SELECT * FROM "contract_methods"
#WHERE identifier = %%identifier int32%%
#ENDSQL
xo query "$PG_URL" --append --trim --strip -o shared/entity --one -T TokenTransfer <<ENDSQL
SELECT COUNT(transaction_hash) FROM "token_transfers"
WHERE transaction_hash = %%hash []byte%%
ENDSQL