Repository navigation
Add exercise persistence schema - #55
Merged
Merged
Conversation
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.
Problem
Routine building needs a persistent exercise catalog that can represent both globally available built-in exercises and custom exercises owned by a registered user.
What changed
exercisestable schema.0002_illegal_captain_flint.sql.Table design
The table contains:
id: generated UUID primary keyowner_user_id: nullable foreign key tousers.idname: required exercise namedescription: optional instructions or explanationcreated_atandupdated_at: timezone-aware timestamps with defaultsOwnership is represented intentionally:
owner_user_id IS NULLmeans the exercise is built into GoForLift.The foreign key uses PostgreSQL's default
NO ACTIONdeletion behavior. Deleting a user therefore cannot silently cascade-delete exercise records. Account and exercise deletion behavior can be finalized deliberately when those operations are implemented.An index on
owner_user_idsupports looking up a user's custom exercises and separating them from built-in catalog entries. No speculative name uniqueness rule or additional indexes were added because those requirements are not yet established.Scope
This PR implements only #54.
Out of scope:
Migration verification
After generating the migration, Drizzle detected three tables and reported the expected exercises shape: six columns, one index, and one foreign key. A second generation reported
No schema changes, nothing to migrate, confirming the schema and metadata are consistent.Verification
pnpm --filter @goforlift/api typecheckpnpm --filter @goforlift/api test— 48 tests passedpnpm --filter @goforlift/api lintgit diff --checkThe migration is committed but was not applied to a developer's local PostgreSQL database as part of this PR.
Closes #54