-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (21 loc) · 920 Bytes
/
Copy pathMakefile
File metadata and controls
29 lines (21 loc) · 920 Bytes
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
include backend/.env
.PHONY: mock clear-db clean reset new-migration run-migrations
POSTGRESQL_URL = 'postgres://$(db_user):$(db_password)@localhost:5435/$(db_name)?sslmode=disable'
MIGRATION_PATH = 'backend/internal/db/migrations'
DB_DOCKER_NAME = 'vrecipes-db-1'
mock: mock_data/mockdata.sql
mkdir -p backend/static/images/
cp mock_data/*.png backend/static/images/
cp mock_data/*.jpg backend/static/images/
docker exec -i $(DB_DOCKER_NAME) psql -U $(db_name) $(db_user) < mock_data/mockdata.sql
clear-db:
echo 'DROP SCHEMA public CASCADE; CREATE SCHEMA public' | docker exec -i $(DB_DOCKER_NAME) psql -U $(db_name) $(db_user)
clean: clear-db
new-migration:
migrate -database ${POSTGRESQL_URL} -path $(MIGRATION_PATH) create -ext sql -dir $(MIGRATION_PATH) $(mig_name_arg)
run-migrations:
migrate -database $(POSTGRESQL_URL) -path $(MIGRATION_PATH) up
reset:
make clean
make run-migrations
make mock