-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (45 loc) · 2.02 KB
/
Makefile
File metadata and controls
59 lines (45 loc) · 2.02 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
53
54
55
56
57
58
59
export GIT_SHA := $(shell git rev-parse HEAD)
dev::
wgo -file sqlc.yaml -file .sql -xfile .go sqlc generate :: wgo run -file .go -file .yaml -debounce 10ms main.go
pretty::
go run cmd/pretty/main.go
build-reward-codes::
go build -o bin/create-reward-codes cmd/create_reward_codes/main.go
indexer::
wgo run -file .go -debounce 10ms main.go indexer
solana-indexer::
wgo run -file .go -debounce 10ms main.go solana-indexer
up: dev
migrate::
go run main.go migrate
test::
sqlc generate
go test -count=1 -cover ./...
esindexer-reindex-stage::
kubectl --context stage -n api exec -it $(kubectl --context stage -n api get pods --no-headers -o custom-columns=":metadata.name" | grep reindexer) -- bridge es-indexer drop all
esindexer-reindex-prod::
kubectl --context prod -n api exec -it $(kubectl --context prod -n api get pods --no-headers -o custom-columns=":metadata.name" | grep reindexer) -- bridge es-indexer drop all
psql::
docker compose exec db psql -U postgres
setup::
go install github.com/bokwoon95/wgo@v0.5.11
go install -v github.com/sqlc-dev/sqlc/cmd/sqlc@v1.29.0
apidiff::
open http://localhost:1323/apidiff.html
test-schema::
@set -a; \
writeDbUrl=postgresql://postgres:example@localhost:21300/postgres; \
echo "\033[0;32mBringing down any existing containers to start fresh...\033[0m"; \
docker compose down --volumes; \
docker compose up -d --wait; \
echo "\n\033[0;32mRunning migrations on fresh instance...\033[0m"; \
make migrate; \
echo "\033[0;32mDumping schema...\033[0m"; \
adjustedUrl=$$(echo "$$writeDbUrl" | sed 's/localhost/host.docker.internal/g'); \
docker compose exec db bash -c "pg_dump '$$adjustedUrl' --schema-only --no-owner --no-acl > ./sql/01_schema.sql"; \
sed '/^\\restrict /d;/^\\unrestrict /d' ./sql/01_schema.sql > ./sql/01_schema.sql.tmp && mv ./sql/01_schema.sql.tmp ./sql/01_schema.sql; \
echo "Schema dumped to ./sql/01_schema.sql"; \
echo "\n\033[0;32mRestarting containers...\033[0m"; \
docker compose down --volumes; \
docker compose up -d --wait; \
echo "\n\033[0;32mDone\033[0m";