docker-compose up
go run cmd/dbmigrate/main.go -migrate=up -dbhost=localhost
- using custom tool:
go run cmd/dbmigrate/main.go \
-migrate=up \
-dbname=csbird \
-dbhost=localhost \
-dbport=5432
- with cli:
migrate -source file://migrations -database postgres://{user}:{password}@{host}:{port}/{dbname}
- sql snippet:
SELECT distinct on (balance) balance, coin, address, time
FROM checkpoints
WHERE time > NOW() - INTERVAL '20 hours';
select
count(distinct balance) - 1 as balance_change_events,
coin,
address
from checkpoints
WHERE time > NOW() - INTERVAL '4 hours'
group by coin, address;