-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
28 lines (20 loc) · 1.02 KB
/
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
.PHONY: keypair migrate-create migrate-up migrate-down migrate-force
PWD = $(shell pwd)
ACCTPATH = $(PWD)/account-server
MPATH = $(ACCTPATH)/migrations
PORT = 5432
# Default number of migrations to execute up or down
N = 1
create-keypair:
@echo "Creating an rsa 256 key pair"
openssl genpkey -algorithm RSA -out $(ACCTPATH)/rsa_private_$(ENV).pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -in $(ACCTPATH)/rsa_private_$(ENV).pem -pubout -out $(ACCTPATH)/rsa_public_$(ENV).pem
migrate-create:
@echo "---Creating migration files---"
migrate create -ext sql -dir $(MPATH) -seq -digits 5 $(NAME)
migrate-up:
migrate -source file://$(MPATH) -database postgres://postgres:password@localhost:$(PORT)/calpal_account?sslmode=disable up $(N)
migrate-down:
migrate -source file://$(MPATH) -database postgres://postgres:password@localhost:$(PORT)/calpal_account?sslmode=disable down $(N)
migrate-force:
migrate -source file://$(MPATH) -database postgres://postgres:password@localhost:$(PORT)/calpal_account?sslmode=disable force $(VERSION)