1
0
Fork 0

feat: add postgres repository for training

This commit is contained in:
Vojtěch Mareš 2024-06-23 10:35:38 +02:00
parent 8c277ef692
commit ff7e320481
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
19 changed files with 1277 additions and 414 deletions

View file

@ -2,3 +2,30 @@
codegen:
@echo "Generating code..."
@oapi-codegen --config=./oapi-codegen.cli.yaml ./api/v1/openapi.yaml
POSTGRES_URL="pgx5://yggdrasil_user:yggdrasil@localhost:5432/yggdrasil?sslmode=disable"
.PHONY: create-migration
create-migration:
migrate create -ext sql -dir ./migrations -seq -digits 3 ${name}
.PHONY: local-migrate-up
local-migrate-up:
migrate -database ${POSTGRES_URL} -path ./migrations up
.PHONY: local-migrate-force
local-migrate-force:
migrate -database ${POSTGRES_URL} -path ./migrations force
.PHONY: local-migrate-down
local-migrate-down:
migrate -database ${POSTGRES_URL} -path ./migrations down
.PHONY: local-migrate-drop
local-migrate-drop:
migrate -database ${POSTGRES_URL} -path ./migrations drop -f
.PHONY: local-db-seed
local-db-seed:
@echo "Seeding database..."
@APP_ENV="development" DATABASE_URL_FILE="postgres_url" go run ./cmd/seed/main.go