File tree Expand file tree Collapse file tree 1 file changed +23
-14
lines changed Expand file tree Collapse file tree 1 file changed +23
-14
lines changed Original file line number Diff line number Diff line change 1
1
DB_URL=postgres://postgres:postgres@localhost:5432/books?sslmode =disable
2
2
MIGRATIONS_DIR =./db/migrations
3
3
4
- migrate-up :
4
+ .PHONY : help migrate-up migrate-down migrate-force sqlc-gen psql up down build clean
5
+
6
+ help : # # Prints all targets
7
+ @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
8
+
9
+ migrate-up : # # Migrate up database
5
10
migrate -database " $( DB_URL) " -path $(MIGRATIONS_DIR ) up
6
11
7
- migrate-down :
12
+ migrate-down : # # Migrate down database
8
13
migrate -database " $( DB_URL) " -path $(MIGRATIONS_DIR ) down
9
14
10
- migrate-force :
15
+ migrate-force : # # Force migrate database to version 1
11
16
migrate -database " $( DB_URL) " -path $(MIGRATIONS_DIR ) force 1
12
17
13
- sqlc-gen :
18
+ sqlc-gen : # # Generate Go code from SQL using sqlc
14
19
sqlc generate
15
20
16
- psql :
21
+ psql : # # Open interactive psql session
17
22
psql $(DB_URL )
18
23
19
- drop-db :
20
- dropdb --if-exists -U postgres books
21
-
22
- up :
24
+ up : # # Start services via docker-compose
23
25
docker-compose up -d
24
26
25
- down :
27
+ down : # # Stop services via docker-compose
26
28
docker-compose down
27
29
28
- seed :
29
- psql $(DB_URL ) -f db/seed.sql
30
-
31
- .PHONY : migrate-up migrate-down migrate-new migrate-force sqlc-gen create-db drop-db psql up down logs
30
+ build : # # Compile the Go application
31
+ go build -o bin/semantic-search ./cmd/main.go
32
+
33
+ clean : # # Clean build files (asks for confirmation)
34
+ @read -p " Are you sure you want to delete ./bin? [y/N] " confirm; \
35
+ if [ " $$ confirm" = " y" ] || [ " $$ confirm" = " Y" ]; then \
36
+ echo " Cleaning..." ; \
37
+ rm -rf bin/; \
38
+ else \
39
+ echo " Aborted." ; \
40
+ fi
You can’t perform that action at this time.
0 commit comments