Session 56: Drop the strength schema #233
Labels
No labels
accessibility
area:accounts
area:ai-evals
area:look
area:maps
area:platform
area:rides-progress
area:riding
area:today-plan-coach
area:ui-shell
bot:blocked
bot:failed
bot:pr
bot:waiting
bot:working
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
later
now
owner-check
parked
question
ready
session
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ckreidl/trainer#233
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
56 · Cycling only: drop the strength schema
Phase: Cycling only 2/2 (owner request 2026-11-08, #231) · Branch:
session/56-drop-strength-schema· Depends on: 55, merged and deployedSession 55 stopped every read and write of strength data. This session removes what's left in the database: the tables, columns and enum values. It's a separate PR because production runs the previous build on the new schema during a deploy and after a rollback, so a column can only go once the build before it no longer uses it (
CLAUDE.md→ Migrations).Read first
docs/decisions.mdentry (how the active plans lost their strength sessions)prisma/schema.prisma,prisma/migrations/(includingexercise_fk_deferredandstrength_prescription, which add raw-SQL constraints),scripts/check-migrations.ts, and an existingBREAKING.mdfor the formatprisma/seed*(the exercise library seed)Goal
bun run db:pullcopy: countSessionLog,LoggedSet, customExerciserows and strengthPlannedSessionrows in versions after 55's step. Record the counts indocs/history.md. If production has any logged strength rows (none on 2026-11-08), stop and ask the owner before dropping them. If the account JSON export should keep them, write it down there.PlanVersions still hold strengthPlannedSessionrows and theirPlannedExerciserows (about 250 on 2026-11-08). Dropping the tables means deleting them, which breaks "plans are append-only" for those versions. Owner decision, open: delete them in the migration (old versions then show rides only), or keepSessionKind.strengthand a minimal record so old versions stay exactly as they were. Read this issue's comments for the answer; if there isn't one, ask before writing the migration. Record the outcome indocs/decisions.md.LoggedSet,SessionLog,PlannedExercise,Exerciseand its exclusion relation,AthleteProfile.strengthPerWeek,PlannedSession's strength-only fields,DailyLoad.strengthTssEq, and the enumsExercisePattern,DoseType,Equipment. Remove the enum valuesSessionKind.strength,PlanTrigger.strength_loggedandAiPurpose.normaliseonce no row uses them. Rewrite or delete oldReplanTriggerandAiCallrows that use them, and say which in the migration. Remove the exercise seed.scripts/check-migrations.tspasses.ruleOverrideswithout them).Rules
db:pullcopy and on the preview database (vercel deploy --target preview --yes) before the PR.Tests
Out of scope
Anything beyond removing strength. File follow-ups as issues.
Done when
grep -rli 'strength\|exercise' prisma srcfinds only the 55 note in the requirements and history, production's schema has no strength objects, and every check passes. Close #231. Finish with the end-of-session ritual inCLAUDE.md.From #241 (session 55): also remove
scripts/remove-strength-sessions.ts,src/server/strength-removal.ts(+ test) and its step inbuild:vercel, plus the session-55 compatibility code that reads old strength data (grepsession 55:StoredPlanTrigger,withoutRetired, thestrengthkind inHistoryKeyandfeedback/schema.ts, thestrength_loggedmapping inclaimRun, thenormaliselabel in the Developer panel).From the 92 review of #241:
scripts/remove-strength-sessions.tsruns at the end ofbuild:vercel, while the old build still serves. A re-plan or generation on the old build in that window can add strength sessions again. Each later deploy removes them, but this session deletes that step. So before removingstrengthfromSessionKind, delete or handle any remainingPlannedSessionrows with kindstrength(and theirPlannedExerciserows) in the migration.