feat: initial commit for newborn tracker with family & role management, full responsive ui, offline assets

This commit is contained in:
gs committed 2026-09-24 08:19:15 +08:00
commit 01f9f2c514
72 files changed
+11186

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
const { pool } = require('./server/db');
async function migrate() {
try {
const [cols] = await pool.query('SHOW COLUMNS FROM custom_metric LIKE "default_value"');
if (cols.length === 0) {
await pool.query("ALTER TABLE custom_metric ADD COLUMN default_value VARCHAR(30) DEFAULT '1' COMMENT '默认打卡数值' AFTER unit");
console.log('Added default_value column to custom_metric');
} else {
console.log('default_value column already exists');
}
// Update existing metrics with proper defaults if needed
await pool.query("UPDATE custom_metric SET default_value = '1' WHERE metric_id = 'metric-d3' AND (default_value IS NULL OR default_value = '')");
await pool.query("UPDATE custom_metric SET default_value = '15' WHERE metric_id = 'metric-tummy' AND (default_value IS NULL OR default_value = '')");
await pool.query("UPDATE custom_metric SET default_value = '1' WHERE metric_id = 'metric-massage' AND (default_value IS NULL OR default_value = '')");
await pool.query("UPDATE custom_metric SET default_value = '36.5' WHERE metric_id = 'metric-temp' AND (default_value IS NULL OR default_value = '')");
console.log('Migration finished successfully!');
process.exit(0);
} catch (e) {
console.error('Migration failed:', e);
process.exit(1);
}
}
migrate();