-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
35 lines (24 loc) · 662 Bytes
/
makefile
File metadata and controls
35 lines (24 loc) · 662 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
30
31
32
33
34
35
GOOSE_CMD=goose -dir database/schema
SQLC_CMD=sqlc
DB_TYPE=postgres
.PHONY: db-migrate, db-rollback, create-migration, db-generate, test, server
db-migrate:
@echo "Migrating database..."
$(GOOSE_CMD) $(DB_TYPE) $$DB_URL up
db-rollback:
@echo "Rolling back database..."
$(GOOSE_CMD) $(DB_TYPE) $$DB_URL down
create-migration:
@if [ -z "$(name)" ]; then \
echo "Please provide a name for the migration. usage: make create-migration name=migration_name"; \
exit 1; \
fi
@echo "Creating migration..."
$(GOOSE_CMD) create $(name) sql
db-generate:
@echo "Generating database code..."
$(SQLC_CMD) generate
test:
@go test -v ./...
server:
air