-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (26 loc) · 1.21 KB
/
Copy pathMakefile
File metadata and controls
37 lines (26 loc) · 1.21 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
27
28
29
30
31
32
33
34
35
36
37
postgres:
docker run --name kinma-postgres -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=password -d postgres:14-alpine
createdb:
docker exec -it kinma-postgres createdb --username=root --owner=root kinma_db
dropdb:
docker exec -it kinma-postgres dropdb kinma_db
migrateup:
migrate -path db/migration -database "postgresql://root:password@localhost:5432/kinma_db?sslmode=disable" -verbose up
migrateup1:
migrate -path db/migration -database "postgresql://root:password@localhost:5432/kinma_db?sslmode=disable" -verbose up 1
migratedown:
migrate -path db/migration -database "postgresql://root:password@localhost:5432/kinma_db?sslmode=disable" -verbose down
#only rollback 1 last migration
migratedown1:
migrate -path db/migration -database "postgresql://root:password@localhost:5432/kinma_db?sslmode=disable" -verbose down 1
#forcely migrate back to the specific version
migrateforce:
migrate -path db/migration -database "postgresql://root:password@localhost:5432/kinma_db?sslmode=disable" force 3
sqlc:
sqlc generate
# Run test and cover all of the package by ./...
test:
go test -v -cover ./...
server:
go run main.go
.PHOMY: postgres createdb migrateup migrateup1 migratedown migratedown1 sqlc test server