docs: add CLAUDE.md with project usage and deployment info

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-06-01 19:40:58 +08:00
parent 8e4d5824c9
commit 8599c4ca87

40
CLAUDE.md Normal file
View File

@@ -0,0 +1,40 @@
# Excel to SQL Server Migration
## 用途
将局域网共享目录中的 Excel (.xlsm) 生产执行卡数据同步并迁移到 SQL Server。
## 部署
```bash
python -m venv .venv
.venv\Scripts\pip install -r requirements.txt
cp config.yaml.example config.yaml # 编辑数据库连接和 LAN 路径
```
## 命令
```bash
# 单次同步 LAN 文件并迁移变更的表
.venv\Scripts\python watch.py --once
# 守护进程模式(定时同步+迁移)
.venv\Scripts\pythonw watch.py
# 全量迁移(所有表,首次使用)
.venv\Scripts\python migrate.py
# 全量迁移(仅预览,不写库)
.venv\Scripts\python migrate.py --dry-run
# 清空后重写指定表
.venv\Scripts\python migrate.py --truncate --table PG_2025 TM_2026
```
## 配置 (config.yaml)
- `sql_server`: 数据库连接信息
- `lan_sources`: 本地相对路径 → LAN UNC 绝对路径
- `tables`: 目标表名与 Excel 源文件/sheet 的映射
- `check_interval_minutes`: watch 守护进程同步间隔(分钟)
- `logging`: 日志级别、目录、保留天数