Add cc as a feeding amount unit - #290
Merged
Merged
Conversation
Adds "cc" alongside oz, ml and g for feeding amounts. SQLite can't alter a CHECK constraint in place, so migration 0010 rebuilds the feedings table with the widened amount_unit constraint. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DQq4Xb6iq9ZJfPzs7afSvY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
ccas an amount unit for feedings, in addition to the existingoz,mlandg.Changes
server/migrations/0010_add_cc_feeding_unit.sql(new) — widens thefeedings.amount_unitCHECK constraint to('ml', 'oz', 'g', 'cc'). SQLite can't alter a CHECK constraint in place, so the migration rebuilds the table and copies rows across, following the same pattern as migration 0008. Existing rows are preserved unchanged and the two indexes are recreated.client/src/types/models.ts—Feeding.amount_unitunion now includes"cc".client/src/pages/FeedingsPage.tsx—ccadded to the unit dropdown on the add/edit feeding form (betweenmlandg).client/src/components/QuickLogDialog.tsx— same option added to the feeding quick-log form.server/test/helpers.ts— registers migration 0010 so the test schema stays in sync with production.server/test/feedings.test.ts— new test assertingPOST /api/feedingsaccepts and round-tripsamount_unit: "cc".Notes
oz/ml— that's a separate table and constraint, and this change was scoped to feedings.ozentries;ccentries are excluded from those totals the same waymlandgentries already are. No unit conversion was introduced.Testing
npm test -w server— 75 tests pass (8 files)npm test -w client— 84 tests pass (11 files)npm run build -w client— succeedsGenerated by Claude Code