-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (24 loc) · 989 Bytes
/
Makefile
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
include app.env
#DB_URL=postgres://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?sslmode=disable
DB_URL=$(DB_SOURCE)
postgres:
docker run --name legal-referral-db -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=IWSIWDF2024 -d postgres:16.4-alpine3.20
redis:
docker run --name legal-referral-redis -p 6379:6379 -d redis:7-alpine
createdb:
docker exec -it legal-referral-db createdb --username=root --owner=root legal_referral_db
dropdb:
docker exec -it legal-referral dropdb legal_referral_db
sqlc:
sqlc generate
migrateup:
migrate -path db/migration -database "$(DB_URL)" -verbose up
migratedown:
migrate -path db/migration -database "$(DB_URL)" -verbose down
new_migration:
migrate create -ext sql -dir db/migration -seq $(name)
migratedown2:
migrate -path db/migration -database "$(DB_URL)" -verbose down 8
server:
go run main.go
.PHONY: postgres createdb dropdb sqlc migrateUp migrateDown migrateDown2 new_migration