Repository navigation
Add core routines table - #57
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
GoForLift needs a persistent user-owned routine record before ordered exercise configuration, schedules, APIs, or routine UI can be implemented.
What changed
routinestable schema.0003_overrated_nightshade.sql.Table design
The table contains:
id: generated UUID primary keyuser_id: required foreign key to the registered ownername: required user-visible routine namedescription: optional routine notescreated_atandupdated_at: timezone-aware timestamps with defaultsEvery routine must have an owner. The foreign key uses PostgreSQL's default
NO ACTIONbehavior, so a user cannot be deleted while routines still reference that user. This avoids silently cascading routine deletion before account-deletion behavior has been deliberately designed.An index on
user_idsupports the initial authorized query pattern: list routines belonging to the current user. No speculative uniqueness constraint was added because users may reasonably create routines with the same name.Scope
This PR implements only #56.
Out of scope:
Migration verification
Drizzle detected the expected routines 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 #56