Files
backend_v2/Makefile
toom1996 299fd974df updae
2026-09-21 19:19:03 +08:00

33 lines
942 B
Makefile
Raw Permalink 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
# 表结构不由服务启动自动创建:全库「结构 + 索引 + 数据」统一由 dbtool 导出的 SQL 维护。
# 导出:go run ./cmd/dbtool dump -out db/backups/db_dump.sql
# 导入:psql -U fashion -d fashion -v ON_ERROR_STOP=1 -f db/backups/db_dump.sql
# 目标库须为空且已启用 pgvector 扩展(导入时可加 -with-extension 让 dump 自带 CREATE EXTENSION)。
migrate:
@echo "Schema is maintained by 'go run ./cmd/dbtool dump' -> psql -f (server no longer auto-migrates)."
# 跑单测
test:
go test ./...
# 整理依赖(需联网拉取测试依赖,离线环境慎用)
tidy:
go mod tidy
# 构建镜像
docker:
docker build -t fashionapi .
# 清理产物
clean:
rm -rf bin server server.exe