-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
26 lines (22 loc) · 1.02 KB
/
Copy pathMakefile
File metadata and controls
26 lines (22 loc) · 1.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
# Easily setup the development environment by running make <command name>
postgres:
docker run --name voxpopuli_postgres -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=root -d postgres:17-alpine
createdb:
docker exec -it voxpopuli_postgres createdb --username=postgres --owner=postgres voxpopuli
dropdb:
docker exec -it voxpopuli_postgres dropdb --username=postgres voxpopuli
migrate-up:
goose -dir internal/db/migrations postgres "postgres://postgres:root@localhost:5432/voxpopuli" up
migrate-down:
goose -dir internal/db/migrations postgres "postgres://postgres:root@localhost:5432/voxpopuli" down
create-migration:
ifdef migration_name
goose -dir internal/db/migrations postgres "postgres://postgres:root@localhost:5432/voxpopuli" create $(migration_name)
else
@echo "Please provide a migration_name argument, e.g., make create-migration migration_name=bug_report"
endif
sqlc-gen:
sqlc generate
server:
go run cmd/main.go
.PHONY: postgres dropdb createdb migrate-up migrate-down create-migration sqlc-gen server