unis_manager/scripts/legacy/README.md

23 lines
1.5 KiB
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# scripts/legacy/ 历史一次性脚本
这些脚本只服务于**过去某次**数据迁移或修复,不参与启动、不被应用调用,也不打进 Docker 镜像。
保留它们是为了历史可追溯、需要时还能复现;日常部署不需要执行。
> 执行前先备份:`cp data/board.db data/board.db.bak-$(date +%Y%m%d_%H%M%S)`
> 大多数脚本支持 `--dry-run`,务必先预演。
| 文件 | 用途 | 用法 |
|---|---|---|
| `migrate_custom.py` | 把旧「定制开发」从通用项目表拆成独立的 `custom_projects` / `custom_updates` | `python scripts/legacy/migrate_custom.py --dry-run` |
| `add_entry_date.py` | 回填定开项目的「入库时间」字段 | `python scripts/legacy/add_entry_date.py --dry-run` |
| `fix_period_split.py` | 修复「8月第4周 / 9月第1周」内容粘连的周期错位 | `python scripts/legacy/fix_period_split.py --dry-run` |
| `merge_project.py` | 把项目 A 的全部数据合并到项目 B 后删除 A | `python scripts/legacy/merge_project.py --from A --to B` |
| `shift_year.py` | 全部周期年份整体平移(默认 +1 年) | `python scripts/legacy/shift_year.py --dry-run` |
## 与当前流程的关系
- 全新库默认**只建空表**,不再自动导入旧 Excel;已有数据请直接带 `data/board.db`。
- 确实要从旧 Excel 全量还原时,顺序是:
`import_excel.py --reset` → `legacy/migrate_custom.py` → `import_staff.py`。
- 迁移到 MySQL 时同样先建表,再按需执行上面的还原链路。