Files
i/server/migrations/0014_grocy_auth.sql
T
wsh5485 65b0bb04f8 feat: import CarLog v2.8 code + dev plan
把 CarLog v2.8 全套源码 + 配置导入到 i 仓库作为 baseline:
- server/src/ (13 个路由 + middleware + services + config)
- server/migrations/ (0001~0018 共 18 个迁移 + mysql)
- server/test/ (12 文件 101 测试)
- client/src/ (20 个 view + components + stores + api + composables)
- client/public/ + client/scripts/
- 全部配置文件 (.editorconfig, .eslintrc.json, .prettierrc.json, vitest.config.js, lighthouserc.json, .pa11yci.json, package.json, carlog-init.sql)
- .husky/pre-commit (git hooks)
- docs/install/ (宝塔部署文档)

不含:
- node_modules/ (本地 npm install)
- .env (敏感, 走 .env.example)
- *.zip / *.log / *.sqlite / .DS_Store

新增文档 docs/DEV-PLAN.md:
- Phase 1: 平台基座 (019 migration + 3 个 platform 路由 + 3 个 view)
- Phase 2: CarLog 子系统化 (后端 routes/ → subsystems/carlog/ + 前端 views/ → views/subsystems/carlog/ + 元数据驱动菜单)
- Phase 3: 验证 (测试 + E2E + DB 完整性)
- 交付清单 + commit 模板 + 给 Mavis review 的材料

后续 Trae 实施, 提交后我 code review + 跑测试。
2026-06-20 22:30:19 +08:00

27 lines
1.3 KiB
SQL

-- =============================================================================
-- Migration 0014: Grocy 鉴权改造 + 同步日志表 + 天气默认城市
-- =============================================================================
-- 1. settings 表:新增 grocy_username / grocy_password
INSERT OR IGNORE INTO settings (key, value, is_secret, description) VALUES
('grocy_username', '', 1, 'Grocy 用户名(session cookie 鉴权)'),
('grocy_password', '', 1, 'Grocy 密码(session cookie 鉴权)');
-- 2. 新增默认城市设置
INSERT OR IGNORE INTO settings (key, value, is_secret, description) VALUES
('app_city_default', '', 0, '天气默认城市(永久生效)');
-- 3. Grocy 同步日志表
CREATE TABLE IF NOT EXISTS grocy_sync_logs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
action TEXT NOT NULL, -- 'pull_products' | 'sync_usage'
status TEXT NOT NULL, -- 'success' | 'failed' | 'partial'
ok_count INTEGER NOT NULL DEFAULT 0,
fail_count INTEGER NOT NULL DEFAULT 0,
detail TEXT, -- JSON 详情
started_at TEXT NOT NULL DEFAULT (datetime('now')),
finished_at TEXT
);
CREATE INDEX IF NOT EXISTS idx_grocy_sync_logs_action ON grocy_sync_logs(action);
CREATE INDEX IF NOT EXISTS idx_grocy_sync_logs_started ON grocy_sync_logs(started_at DESC);