Files
backend_v2/Makefile
toom1996 f7ae917603 update
2026-09-17 22:51:00 +08:00

34 lines
963 B
Makefile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.PHONY: build run migrate test tidy docker clean
# 编译 server
build:
go build -o bin/server ./cmd/server
# 构建并启动 API 服务(默认读取 configs/config.yml)
run: build
./bin/server
# 表结构由 GORM AutoMigrate 在 server 启动时幂等创建,无需手动 SQL。
# 跨环境搬运全库数据(结构 + 数据)用 dbtool:
# go run ./cmd/dbtool dump -out db_dump.json
# go run ./cmd/dbtool import -in db_dump.json # 整机重建
# go run ./cmd/dbtool import -in db_dump.json -data-only # 仅导数据(结构已由 AutoMigrate 建好)
migrate:
@echo "Schema is auto-migrated by server on startup (GORM AutoMigrate). Use 'go run ./cmd/dbtool' to move data between environments."
# 跑单测
test:
go test ./...
# 整理依赖(需联网拉取测试依赖,离线环境慎用)
tidy:
go mod tidy
# 构建镜像
docker:
docker build -t fashionapi .
# 清理产物
clean:
rm -rf bin server server.exe