v1.2.0:4 — make avg. watts a first-class SetLog field
Average watts (assault bike, rower, ski erg) was a free-text entry stuffed into the per-set customMetrics JSON blob. Promote it to a real nullable column, SetLog.watts, written through every set path (create / PATCH / add-sets / import-save / account-import) and shown everywhere as "Avg. watts" with a proper numeric input. The column is added by the boot-time guarded ALTER in docker_entrypoint.sh (additive, idempotent), so the version migration stays empty. Existing data is untouched: legacy watts values remain readable from customMetrics and migrate to the column the next time a set is saved.
This commit is contained in:
@@ -72,6 +72,11 @@ if command -v sqlite3 >/dev/null 2>&1 && [ -f "$DB_PATH" ]; then
|
||||
sqlite3 "$DB_PATH" "ALTER TABLE SetLog ADD COLUMN customMetrics TEXT;"
|
||||
fi
|
||||
|
||||
if ! sqlite3 "$DB_PATH" "PRAGMA table_info('SetLog');" 2>/dev/null | grep -q "|watts|"; then
|
||||
log "adding missing column SetLog.watts"
|
||||
sqlite3 "$DB_PATH" "ALTER TABLE SetLog ADD COLUMN watts INTEGER;"
|
||||
fi
|
||||
|
||||
if ! sqlite3 "$DB_PATH" "PRAGMA table_info('Workout');" 2>/dev/null | grep -q "|deletedAt|"; then
|
||||
log "adding missing column Workout.deletedAt"
|
||||
sqlite3 "$DB_PATH" "ALTER TABLE Workout ADD COLUMN deletedAt DATETIME;"
|
||||
|
||||
Reference in New Issue
Block a user