2023-09-07 15:34:15 +07:00
|
|
|
include dev.env
|
|
|
|
|
|
|
|
migrateup:
|
|
|
|
migrate -path db/migrations -database "${DB_TYPE}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=disable" -verbose up
|
2023-09-12 12:52:01 +07:00
|
|
|
migrate -path db/migrations -database "${DB_TYPE}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}_test?sslmode=disable" -verbose up
|
2023-09-07 15:34:15 +07:00
|
|
|
|
|
|
|
migratedown:
|
2023-09-13 21:42:04 +07:00
|
|
|
migrate -path db/migrations -database "${DB_TYPE}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=disable" -verbose down $n
|
|
|
|
migrate -path db/migrations -database "${DB_TYPE}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}_test?sslmode=disable" -verbose down $n
|
2023-09-12 12:52:01 +07:00
|
|
|
|
2023-09-24 15:00:52 +07:00
|
|
|
seed:
|
|
|
|
./import_csv.sh
|
|
|
|
|
2023-09-20 13:36:47 +07:00
|
|
|
migraterestart:
|
|
|
|
$(MAKE) migratedown
|
|
|
|
$(MAKE) migrateup
|
2023-09-24 15:00:52 +07:00
|
|
|
$(MAKE) seed
|
2023-09-07 15:34:15 +07:00
|
|
|
|
|
|
|
mock-generate:
|
2023-09-12 12:52:01 +07:00
|
|
|
mockgen -package mockdb -destination db/mock/store.go git.nochill.in/nochill/hiling_go/db/sqlc Store
|
2023-09-07 15:34:15 +07:00
|
|
|
|
|
|
|
sqlc:
|
|
|
|
sqlc generate && make mock-generate
|
|
|
|
|
|
|
|
test:
|
|
|
|
go test -v -cover ./...
|
|
|
|
|
|
|
|
server:
|
|
|
|
go run main.go
|
|
|
|
|
2023-09-20 13:36:47 +07:00
|
|
|
.PHONY: server migrateup migratedown sqlc migraterestart
|